Session
Object Hierarchy:
Description:
All known sub-classes:
Namespace: Soup
Package: libsoup-2.4
Content:
Properties:
- public string accept_language { owned get; set; }
If non-%NULL, the value to use for the "Accept-Language" header on Messages sent from this session.
- public bool accept_language_auto { get; set; }
If
true
, Session will automatically set the string for the "Accept-Language" header on every Message sent, based on the return value of get_language_names. - public MainContext async_context { get; owned construct; }
The MainContext that miscellaneous session-related asynchronous callbacks are invoked on.
- public string[] http_aliases { owned get; set; }
A
null
-terminated array of URI schemes that should be considered to be aliases for "http". - public string[] https_aliases { owned get; set; }
A comma-delimited list of URI schemes that should be considered to be aliases for "https".
- public uint idle_timeout { get; set; }
Connection lifetime (in seconds) when idle.
- public Address local_address { owned get; construct; }
Sets the Address to use for the client side of the connection.
- public int max_conns { get; set; }
- public int max_conns_per_host { get; set; }
- public ProxyResolver proxy_resolver { owned get; set; }
A ProxyResolver to use with this session.
- public URI proxy_uri { owned get; set; }
A proxy to use for all http and https requests in this session.
- public string ssl_ca_file { owned get; set; }
File containing SSL CA certificates.
- public bool ssl_strict { get; set; }
Normally, if tls_database is set (including if it was set via ssl_use_system_ca_file or ssl_ca_file), then libsoup will reject any certificate that is invalid (ie, expired) or that is not signed by one of the given CA certificates, and the Message will fail with the status SSL_FAILED.
- public bool ssl_use_system_ca_file { get; set; }
Setting this to
true
is equivalent to setting tls_database to the default system CA database. - public uint timeout { get; set; }
The timeout (in seconds) for socket I/O operations (including connecting to a server, and waiting for a reply to an HTTP request).
- public TlsDatabase tls_database { owned get; set; }
Sets the TlsDatabase to use for validating SSL/TLS certificates.
- public TlsInteraction tls_interaction { owned get; set; }
A TlsInteraction object that will be passed on to any TlsConnections created by the session.
- public bool use_ntlm { get; set; }
Whether or not to use NTLM authentication.
- public bool use_thread_context { get; set; }
If
true
(which it always is on a plain Session), asynchronous HTTP requests in this session will run in whatever the thread-default MainContext is at the time they are started, rather than always occurring in async_context. - public string user_agent { owned get; set; }
If non-%NULL, the value to use for the "User-Agent" header on Messages sent from this session.
Creation methods:
- public Session ()
Creates a Session with the default options.
- public Session.with_options (string optname1, ...)
Creates a Session with the specified options.
Methods:
- public void abort ()
Cancels all pending requests in this and closes all idle persistent connections.
- public void add_feature (SessionFeature feature)
Adds
feature
's functionality to this . - public void add_feature_by_type (Type feature_type)
If
feature_type
is the type of a class that implements SessionFeature, this creates a new feature of that type and adds it to this as with add_feature. - public virtual void auth_required (Message msg, Auth auth, bool retrying)
- public virtual void cancel_message (Message msg, uint status_code)
Causes this to immediately finish processing
msg
(regardless of its current state) with a final status_code ofstatus_code
. - public async IOStream connect_async (URI uri, Cancellable? cancellable, SessionConnectProgressCallback? progress_callback) throws Error
Start a connection to
uri
. - public virtual void flush_queue ()
- public unowned MainContext? get_async_context ()
Gets this's async_context.
- public unowned SessionFeature? get_feature (Type feature_type)
Gets the first feature in this of type
feature_type
. - public unowned SessionFeature? get_feature_for_message (Type feature_type, Message msg)
Gets the first feature in this of type
feature_type
, provided that it is not disabled formsg
. - public SList<SessionFeature> get_features (Type feature_type)
Generates a list of this's features of type
feature_type
. - public bool has_feature (Type feature_type)
Tests if this has at a feature of type
feature_type
(which can be the type of either a SessionFeature, or else a subtype of some class managed by another feature, such as Auth or Request ). - public virtual void kick ()
- public void pause_message (Message msg)
Pauses HTTP I/O on
msg
. - public void prefetch_dns (string hostname, Cancellable? cancellable, AddressCallback? callback)
Tells this that an URI from the given
hostname
may be requested shortly, and so the session can try to prepare by resolving the domain name in advance, in order to work more quickly once the URI is actually requested. - public void prepare_for_uri (URI uri)
Tells this that
uri
may be requested shortly, and so the session can try to prepare (resolving the domain name, obtaining proxy address, etc. - public virtual void queue_message (owned Message msg, SessionCallback? callback)
Queues the message
msg
for asynchronously sending the request and receiving a response in the current thread-default MainContext. - public bool redirect_message (Message msg)
Updates
msg
's URI according to its status code and "Location" header, and requeues it on this. - public void remove_feature (SessionFeature feature)
Removes
feature
's functionality from this. - public void remove_feature_by_type (Type feature_type)
Removes all features of type
feature_type
(or any subclass offeature_type
) from this. - public Request request (string uri_string) throws Error
Creates a Request for retrieving
uri_string
. - public RequestHTTP request_http (string method, string uri_string) throws Error
Creates a Request for retrieving
uri_string
, which must be an "http" or "https" URI (or another protocol listed in this's http_aliases or https_aliases). - public RequestHTTP request_http_uri (string method, URI uri) throws Error
Creates a Request for retrieving
uri
, which must be an "http" or "https" URI (or another protocol listed in this 's http_aliases or https_aliases). - public Request request_uri (URI uri) throws Error
Creates a Request for retrieving
uri
. - public virtual void requeue_message (Message msg)
This causes
msg
to be placed back on the queue to be attempted again. - public InputStream send (Message msg, Cancellable? cancellable = null) throws Error
Synchronously sends
msg
and waits for the beginning of a response. - public async InputStream send_async (Message msg, Cancellable? cancellable = null) throws Error
Asynchronously sends
msg
and waits for the beginning of a response. - public virtual uint send_message (Message msg)
Synchronously send
msg
. - public IOStream steal_connection (Message msg)
"Steals" the HTTP connection associated with
msg
from this. - public void unpause_message (Message msg)
Resumes HTTP I/O on
msg
. - public async WebsocketConnection websocket_connect_async (Message msg, string? origin, string[]? protocols, Cancellable? cancellable) throws Error
Asynchronously creates a WebsocketConnection to communicate with a remote server.
- public bool would_redirect (Message msg)
Checks if
msg
contains a response that would cause this to redirect it to a new URL (ignoringmsg
's NO_REDIRECT flag, and the number of times it has already been redirected).
Signals:
- public virtual signal void authenticate (Message msg, Auth auth, bool retrying)
Emitted when the session requires authentication.
- public signal void connection_created (Object connection)
Emitted when a new connection is created.
- public signal void request_queued (Message msg)
Emitted when a request is queued on
session
. - public virtual signal void request_started (Message msg, Socket socket)
Emitted just before a request is sent.
- public signal void request_unqueued (Message msg)
Emitted when a request is removed from
session
's queue, indicating thatsession
is done with it. - public signal void tunneling (Object connection)
Emitted when an SSL tunnel is being created on a proxy connection.
Inherited Members:
All known members inherited from class GLib.Object