Session
Soup session state object.
#SoupSession is the object that controls client-side HTTP. A #SoupSession 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 #SoupSession; 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 #SoupSession functionality is provided by iface@SessionFeature objects, which can be added to a session with method@Session.add_feature or method@Session.add_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 #SoupSession 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.
Skipped during bindings generation
method
accept-language
: Property TypeInfo of getter and setter do not matchmethod
user-agent
: Property TypeInfo of getter and setter do not matchconstructor
new_with_options
: Varargs parameter is not supported
Constructors
Properties
If true, #SoupSession will automatically set the string for the "Accept-Language" header on every class@Message sent, based on the return value of func@GLib.get_language_names.
Connection lifetime (in seconds) when idle. Any connection left idle longer than this will be closed.
Sets the class@Gio.InetSocketAddress to use for the client side of the connection.
The maximum number of connections that the session can open at once to a given host.
A iface@Gio.ProxyResolver to use with this session.
Sets a socket to make outgoing connections on. This will override the default behaviour of opening TCP/IP sockets to the hosts specified in the URIs.
Sets the class@Gio.TlsDatabase to use for validating SSL/TLS certificates.
A class@Gio.TlsInteraction object that will be passed on to any class@Gio.TlsConnections created by the session.
Functions
Adds @feature's functionality to @session. You cannot add multiple features of the same alias@GObject.Type to a session.
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 @session as with method@Session.add_feature. You can use this when you don't need to customize the new feature in any way. Adding multiple features of the same @feature_type is not allowed.
Emitted when a request is queued on @session.
Emitted when a request is removed from @session's queue, indicating that @session is done with it.
Get the value used by @session for the "Accept-Language" header on new requests.
Gets the class@Message of the @result asynchronous operation This is useful to get the class@Message of an asynchronous operation started by @session from its callback@Gio.AsyncReadyCallback.
Gets the feature in @session of type @feature_type.
Gets the feature in @session of type @feature_type, provided that it is not disabled for @msg.
Get the value used by @session for the "User-Agent" header on new requests.
Tests if @session 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).
Start a preconnection to @msg.
Complete a preconnect async operation started with method@Session.preconnect_async.
Removes @feature's functionality from @session.
Removes all features of type @feature_type (or any subclass of
Synchronously sends @msg and reads the response body.
Asynchronously sends @msg and reads the response body.
Gets the response to a method@Session.send_and_read_async.
Synchronously sends @msg and splices the response body stream into @out_stream.
Asynchronously sends @msg and splices the response body stream into @out_stream. When @callback is called, then either @msg has been sent and its response body spliced, or else an error has occurred.
Gets the response to a method@Session.send_and_splice_async.
Gets the response to a method@Session.send_async call.
Set the value to use for the "Accept-Language" header on class@Messages sent from @session.
Set the value to use for the "User-Agent" header on class@Messages sent from @session.
Asynchronously creates a class@WebsocketConnection to communicate with a remote server.
Gets the class@WebsocketConnection response to a method@Session.websocket_connect_async call.