summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--daemon/gvfsbackendhttp.c26
2 files changed, 32 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 075dcdb7..a28ae3df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-16 Christian Kellner <gicmo@gnome.org>
+
+ * daemon/gvfsbackendhttp.c:
+ Add logging for soup so we can get easy network traces even
+ if we are doing https.
+
2008-04-15 Matthias Clasen <mclasen@redhat.com>
Bug 526454 – too early use of dbus session bus
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);
+ }
+
}
/* ************************************************************************* */