Advanced UsageCustomizing Session OptionsWhen you create the session with soup_session_new_with_options(),
you can specify various additional options. See the SoupSession documentation for more details but these may be interesting:
SoupSession:max-conns and SoupSession:max-conns-per-host,
SoupSession:user-agent, SoupSession:timeout,
SoupSession:accept-language and SoupSession:accept-language-autoAdding Session FeaturesAdditional session functionality is provided as SoupSessionFeatures,
which can be added to or removed from a session.One such feature is SoupContentDecoder
which is added by default. This advertises to servers that the
client supports compression, and automatically decompresses compressed
responses.
Some other available features that you can add include:
SoupLogger
A debugging aid, which logs all of libsoup's HTTP traffic
to stdout (or another place you specify).
SoupCookieJar,
SoupCookieJarText,
and SoupCookieJarDB
Support for HTTP cookies. SoupCookieJar
provides non-persistent cookie storage, while
SoupCookieJarText uses a text file to keep
track of cookies between sessions, and
SoupCookieJarDB uses a
SQLite database.
SoupContentSniffer
Uses the HTML5 sniffing rules to attempt to
determine the Content-Type of a response when the
server does not identify the Content-Type, or appears to
have provided an incorrect one.
Use the soup_session_add_feature_by_type() function to
add features that don't require any configuration (such as SoupContentSniffer),
and the soup_session_add_feature()function to add features that must be
constructed first (such as SoupLogger). For example, an
application might do something like the following:
You can also remove features by calling soup_session_remove_feature() or
soup_session_remove_feature_by_type().
See the Additional Features section for other features.
Using a proxyBy default libsoup tries to respect the default proxy (as best as g_proxy_resolver_get_default() knows), however you can set
a custom one or disable it outright using the SoupSession:proxy-resolver
property. For example:Using the SoupMessage APIThe SoupMessage type contains all the state for a request and response pair that you send and recieve
to a server. For many more complex tasks you will have to create one of these and send it with the soup_session_send()
function. For example this sends a request with the HEAD method:
Handling authentication