SoupSession
Object Hierarchy:
Description:
[
CCode ( type_id =
"e_soup_session_get_type ()" ) ]
[
Version ( since =
"3.26" ) ]
public class SoupSession :
Session
Contains only private data that should be read and manipulated using the functions below.
Content:
Properties:
- public NamedParameters credentials { owned get; set; }
- public bool force_http1 { get; set; }
Whether the messages created by the session should force use of HTTP/1
instead of trying HTTP/2 first and fallback to the HTTP/1 when the newer version failed to connect.
- public bool handle_backoff_responses { get; set; }
Set to true, which is the default,
to automatically handle backoff responses from the server, that is, when the server requests the client to retry later.
- public Source source { get; construct; }
The Source being used for
this soup session.
Static methods:
- public static Quark error_quark ()
- public static bool util_get_force_http1_supported ()
- public static unowned ByteArray? util_get_message_bytes (Message message)
Returns bytes read from the message response, when the message send
failed.
- public static Uri? util_normalize_uri_path (Uri uri)
Normalizes the path of the uri, aka encodes characters,
which should be encoded, if needed.
- public static InputStream? util_ref_message_request_body (Message message, out ssize_t out_length)
- public static void util_set_message_request_body (Message message, string? content_type, InputStream input_stream, ssize_t length)
Sets the request body of the message from the
input_stream of the length, with optional content_type.
- public static void util_set_message_request_body_from_data (Message message, bool create_copy, string? content_type, void* data, ssize_t length, DestroyNotify? free_func)
Sets the request body of the message from the data
of the length, with optional content_type.
- public static unowned string util_status_to_string (uint status_code, string? reason_phrase)
Returns the reason_phrase, if it's non-
null and non-empty, a static string corresponding to status_code.
Creation methods:
Methods:
- public bool check_result (Message message, void* read_bytes, size_t bytes_length) throws Error
Checks result of the message and sets the
throws if it failed.
- public NamedParameters? dup_credentials ()
- public bool get_authentication_requires_credentials ()
- public bool get_force_http1 ()
Returns whether it's forced to use HTTP/1 for the messages created by
the this.
- public bool get_handle_backoff_responses ()
Returns whether the this can handle
backoff responses from the server.
- public LoggerLogLevel get_log_level ()
- public unowned Source? get_source ()
Returns an Source associated
with the this, if such was set in the creation time.
- public bool get_ssl_error_details (out string out_certificate_pem, out TlsCertificateFlags out_certificate_errors)
Populates out_certificate_pem and
out_certificate_errors with the last values returned on
BAD_CERTIFICATE error.
- public void handle_authentication_failure (NamedParameters? credentials, Error op_error, out SourceAuthenticationResult out_auth_result, out string out_certificate_pem, out TlsCertificateFlags out_certificate_errors) throws Error
Handles authentication failure and sets appropriate value to the
out_auth_result for the provided op_error and used credentials.
- public Message new_message (string method, string uri_string) throws Error
Creates a new
Message, similar to
Message, but also presets request headers with
"User-Agent" to be "Evolution/version" and with "Connection" to be "close".
- public Message new_message_from_uri (string method, Uri uri) throws Error
Creates a new
Message, similar to
Message.from_uri, but also presets request
headers with "User-Agent" to be "Evolution/version" and with "Connection" to be "close".
- public void* prepare_message_send_sync (Message message, Cancellable? cancellable = null) throws Error
Prepares the message to be a sent asynchronously with
send_message.
- public async InputStream? send_message (Message message, int io_priority, void* prepare_data, Cancellable? cancellable, out string? out_certificate_pem, out TlsCertificateFlags out_certificate_errors) throws Error
Asynchronously sends the message.
- public ByteArray send_message_simple_sync (Message message, Cancellable? cancellable = null) throws Error
- public InputStream send_message_sync (Message message, Cancellable? cancellable = null) throws Error
Synchronously sends prepared message and returns
InputStream that can be used to read its contents.
- public void set_credentials (NamedParameters? credentials)
Sets credentials to use for connection.
- public void set_force_http1 (bool force_http1)
Sets whether the messages created through the
this using new_message or
new_message_from_uri should force use of the HTTP/1, instead of
trying HTTP/2 and fallback to HTTP/1, when the newer version cannot be used.
- public void set_handle_backoff_responses (bool handle_backoff_responses)
Sets whether to automatically handle backoff responses from the
server, that is, when the server requests the client to retry later.
- public void setup_logging (string? logging_level)
Setups logging for the this.
Inherited Members:
All known members inherited from class Soup.Session
All known members inherited from class GLib.Object