Session is the object that controls client-side HTTP. A Session encapsulates all of
the state that libsoup is keeping on behalf of your program; cached HTTP connections, authentication information, etc. It also keeps
track of various global options and features that you are using.
Most applications will only need a single Session; the primary reason you might need multiple sessions is if
you need to have multiple independent authentication contexts. (Eg, you are connecting to a server and authenticating as two different
users at different times; the easiest way to ensure that each [class@Message] is sent with the authentication information you intended is
to use one session for the first user, and a second session for the other user.)
Additional Session functionality is provided by [iface@SessionFeature] objects, which can be added to a
session with [[email protected]_feature] or [[email protected]_feature_by_type] For example, [class@Logger] provides support for logging
HTTP traffic, [class@ContentDecoder] provides support for compressed response handling, and [class@ContentSniffer] provides support for
HTML5-style response body content sniffing. Additionally, subtypes of [class@Auth] can be added as features, to add support for additional
authentication types.
All `SoupSession`s are created with a [class@AuthManager], and support for soup_type_auth_basic and
soup_type_auth_digest. Additionally, sessions using the plain Session class (
rather than one of its deprecated subtypes) have a [class@ContentDecoder] by default.
Note that all async methods will invoke their callbacks on the thread-default context at the time of the function call.
If true, Session
will automatically set the string for the "Accept-Language" header on every [class@Message] sent, based on the return value of
[func@GLib.
If feature_type is the type of a class that implements [
iface@SessionFeature], this creates a new feature of that type and adds it to this as with [
method@Session.
Gets the [class@Message] of the result asynchronous
operation This is useful to get the [class@Message] of an asynchronous operation started by this
from its [callback@Gio.
Tests if this has at a feature of
type feature_type (which can be the type of either a [iface@SessionFeature], or else a subtype of some class managed by
another feature, such as [class@Auth]).
publicasyncboolpreconnect_async (Message msg, int io_priority, Cancellable? cancellable) throwsError