summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendhttp.c
diff options
context:
space:
mode:
authorChristian Kellner <gicmo@src.gnome.org>2008-04-16 15:56:11 +0000
committerChristian Kellner <gicmo@src.gnome.org>2008-04-16 15:56:11 +0000
commit25c09786bc90b204f86f821e8150f16562c68077 (patch)
treea35c6fa9854f311bac6c73254609ec3534a0c53b /daemon/gvfsbackendhttp.c
parent120ea24c9f848d4dc44d8b49b1505f5ac512345f (diff)
downloadgvfs-25c09786bc90b204f86f821e8150f16562c68077.tar.gz
Add debug logging support for http/dav
* daemon/gvfsbackendhttp.c: Add logging for soup so we can get easy network traces even if we are doing https. svn path=/trunk/; revision=1739
Diffstat (limited to 'daemon/gvfsbackendhttp.c')
-rw-r--r--daemon/gvfsbackendhttp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/daemon/gvfsbackendhttp.c b/daemon/gvfsbackendhttp.c
index fd72cf37..94fa0a2c 100644
--- a/daemon/gvfsbackendhttp.c
+++ b/daemon/gvfsbackendhttp.c
@@ -75,9 +75,13 @@ g_vfs_backend_http_finalize (GObject *object)
(*G_OBJECT_CLASS (g_vfs_backend_http_parent_class)->finalize) (object);
}
+#define DEBUG_MAX_BODY_SIZE (100 * 1024 * 1024)
+
static void
g_vfs_backend_http_init (GVfsBackendHttp *backend)
{
+ const char *debug;
+
g_vfs_backend_set_user_visible (G_VFS_BACKEND (backend), FALSE);
backend->session = soup_session_sync_new_with_options ("user-agent",
@@ -87,6 +91,28 @@ g_vfs_backend_http_init (GVfsBackendHttp *backend)
backend->session_async = soup_session_async_new_with_options ("user-agent",
"gvfs/" VERSION,
NULL);
+
+ /* Logging */
+ debug = g_getenv ("GVFS_HTTP_DEBUG");
+ if (debug)
+ {
+ SoupLogger *logger;
+ SoupLoggerLogLevel level;
+
+ if (g_ascii_strcasecmp (debug, "all") ||
+ g_ascii_strcasecmp (debug, "body"))
+ level = SOUP_LOGGER_LOG_BODY;
+ else if (g_ascii_strcasecmp (debug, "header"))
+ level = SOUP_LOGGER_LOG_HEADERS;
+ else
+ level = SOUP_LOGGER_LOG_MINIMAL;
+
+ logger = soup_logger_new (level, DEBUG_MAX_BODY_SIZE);
+ soup_logger_attach (logger, backend->session);
+ soup_logger_attach (logger, backend->session_async);
+ g_object_unref (logger);
+ }
+
}
/* ************************************************************************* */