Cookies sent in http headers do not get logged by SoupLogger
Submitted by Christophe Fergeau
Assigned to libsoup-maint@gnome.bugs
Link to original bug (#712230)
Description
Logging this bug in case it would be a useful improvement, but a NOTABUG resolution also makes sense to me ;)
I've been using librest with REST_DEBUG=proxy set to dump all the http requests done when interacting with a webservice. While I can see the Set-Cookie headers in the HTTP response from the service, I do not see the corresponding Cookie header in requests sent to the service, even though the cookie seems to be sent (from the service behaviour and from a breakpoint in the appropriate SoupCookieJar method).
For logging, REST_DEBUG=proxy uses if (REST_DEBUG_ENABLED(PROXY)) { SoupSessionFeature logger = (SoupSessionFeature)soup_logger_new (SOUP_LOGGER_LOG_BODY, 0); soup_session_add_feature (priv->session, logger); g_object_unref (logger);
logger = (SoupSessionFeature*)soup_logger_new (SOUP_LOGGER_LOG_BODY, 0);
soup_session_add_feature (priv->session_sync, logger);
g_object_unref (logger);
}
What happens is that both logging and cookies are SoupSessionFeatures which hook into request_start()/... to do their work, and librest is first adding the logger and then the cookie jar. This can easily be avoided in librest by registering the features in the correct order (first cookie jar, then logger), but I'm wondering if libsoup should use g_signal_connect_after for SoupLogger so that logging is done after the various feature callbacks have run (I've tested 2 patches doing this, but both are ugly, one c&p a bunch of soup-session-feature.c into soup-logger.c, the other adds a if (SOUP_IS_LOGGER(feature)) connect_flags = G_CONNECT_AFTER; in soup-session-feature.c. I can attach them if needed :)
Version: 2.44.x