Gjsify LogoGjsify Logo

Contains only private data that should be read and manipulated using the functions below.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

Properties

accept_language: string

If non-%NULL, the value to use for the "Accept-Language" header on #SoupMessages sent from this session.

Setting this will disable #SoupSession:accept-language-auto.

accept_language_auto: boolean

If %TRUE, #SoupSession will automatically set the string for the "Accept-Language" header on every #SoupMessage sent, based on the return value of g_get_language_names().

Setting this will override any previous value of #SoupSession:accept-language.

async_context: object

The #GMainContext that miscellaneous session-related asynchronous callbacks are invoked on. (Eg, setting #SoupSession:idle-timeout will add a timeout source on this context.)

For a plain #SoupSession, this property is always set to the #GMainContext that is the thread-default at the time the session was created, and cannot be overridden. For the deprecated #SoupSession subclasses, the default value is %NULL, meaning to use the global default #GMainContext.

If #SoupSession:use-thread-context is %FALSE, this context will also be used for asynchronous HTTP I/O.

credentials: NamedParameters

The #ENamedParameters containing login credentials.

g_type_instance: TypeInstance
http_aliases: string[]

A %NULL-terminated array of URI schemes that should be considered to be aliases for "http". Eg, if this included "dav", than a URI of dav://example.com/path would be treated identically to http://example.com/path.

In a plain #SoupSession, the default value is %NULL, meaning that only "http" is recognized as meaning "http". In #SoupSessionAsync and #SoupSessionSync, for backward compatibility, the default value is an array containing the single element "*", a special value which means that any scheme except "https" is considered to be an alias for "http".

See also #SoupSession:https-aliases.

https_aliases: string[]

A comma-delimited list of URI schemes that should be considered to be aliases for "https". See #SoupSession:http-aliases for more information.

The default value is %NULL, meaning that no URI schemes are considered aliases for "https".

idle_timeout: number

Connection lifetime (in seconds) when idle. Any connection left idle longer than this will be closed.

Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call soup_session_abort() after setting this if you want to ensure that all future connections will have this timeout value.

Note that the default value of 60 seconds only applies to plain #SoupSessions. If you are using #SoupSessionAsync or #SoupSessionSync, the default value is 0 (meaning idle connections will never time out).

local_address: Soup.Address

Sets the #SoupAddress to use for the client side of the connection.

Use this property if you want for instance to bind the local socket to a specific IP address.

max_conns: number
max_conns_per_host: number
parent: GObject.Object
proxy_resolver: Gio.ProxyResolver

A #GProxyResolver to use with this session. Setting this will clear the #SoupSession:proxy-uri property, and remove any SoupProxyURIResolver features that have been added to the session.

By default, in a plain #SoupSession, this is set to the default #GProxyResolver, but you can set it to %NULL if you don't want to use proxies, or set it to your own #GProxyResolver if you want to control what proxies get used.

proxy_uri: Soup.URI

A proxy to use for all http and https requests in this session. Setting this will clear the #SoupSession:proxy-resolver property, and remove any SoupProxyURIResolver features that have been added to the session. Setting this property will also cancel all currently pending messages.

Note that #SoupSession will normally handle looking up the user's proxy settings for you; you should only use #SoupSession:proxy-uri if you need to override the user's normal proxy settings.

Also note that this proxy will be used for all requests; even requests to localhost. If you need more control over proxies, you can create a #GSimpleProxyResolver and set the #SoupSession:proxy-resolver property.

The #ESource being used for this soup session.

ssl_ca_file: string

File containing SSL CA certificates.

If the specified file does not exist or cannot be read, then libsoup will print a warning, and then behave as though it had read in a empty CA file, meaning that all SSL certificates will be considered invalid.

ssl_strict: boolean

Normally, if #SoupSession:tls-database is set (including if it was set via #SoupSession:ssl-use-system-ca-file or #SoupSession: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 #SoupMessage will fail with the status %SOUP_STATUS_SSL_FAILED.

If you set #SoupSession:ssl-strict to %FALSE, then all certificates will be accepted, and you will need to call soup_message_get_https_status() to distinguish valid from invalid certificates. (This can be used, eg, if you want to accept invalid certificates after giving some sort of warning.)

For a plain #SoupSession, if the session has no CA file or TLS database, and this property is %TRUE, then all certificates will be rejected. However, beware that the deprecated #SoupSession subclasses (#SoupSessionAsync and #SoupSessionSync) have the opposite behavior: if there is no CA file or TLS database, then all certificates are always accepted, and this property has no effect.

ssl_use_system_ca_file: boolean

Setting this to %TRUE is equivalent to setting #SoupSession:tls-database to the default system CA database. (and likewise, setting #SoupSession:tls-database to the default database by hand will cause this property to become %TRUE).

Setting this to %FALSE (when it was previously %TRUE) will clear the #SoupSession:tls-database field.

See #SoupSession:ssl-strict for more information on how https certificate validation is handled.

If you are using #SoupSessionAsync or #SoupSessionSync, on libsoup older than 2.74.0, the default value is %FALSE, for backward compatibility.

timeout: number

The timeout (in seconds) for socket I/O operations (including connecting to a server, and waiting for a reply to an HTTP request).

Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call soup_session_abort() after setting this if you want to ensure that all future connections will have this timeout value.

Note that the default value of 60 seconds only applies to plain #SoupSessions. If you are using #SoupSessionAsync or #SoupSessionSync, the default value is 0 (meaning socket I/O will not time out).

Not to be confused with #SoupSession:idle-timeout (which is the length of time that idle persistent connections will be kept open).

tls_database: TlsDatabase

Sets the #GTlsDatabase to use for validating SSL/TLS certificates.

Note that setting the #SoupSession:ssl-ca-file or #SoupSession:ssl-use-system-ca-file property will cause this property to be set to a #GTlsDatabase corresponding to the indicated file or system default.

See #SoupSession:ssl-strict for more information on how https certificate validation is handled.

If you are using a plain #SoupSession then #SoupSession:ssl-use-system-ca-file will be %TRUE by default, and so this property will be a copy of the system CA database. If you are using #SoupSessionAsync or #SoupSessionSync, on libsoup older than 2.74.0, this property will be %NULL by default.

tls_interaction: TlsInteraction

A #GTlsInteraction object that will be passed on to any #GTlsConnections created by the session. (This can be used to provide client-side certificates, for example.)

use_ntlm: boolean

Whether or not to use NTLM authentication.

use_thread_context: boolean

If %TRUE (which it always is on a plain #SoupSession), asynchronous HTTP requests in this session will run in whatever the thread-default #GMainContext is at the time they are started, rather than always occurring in #SoupSession:async-context.

user_agent: string

If non-%NULL, the value to use for the "User-Agent" header on #SoupMessages sent from this session.

RFC 2616 says: "The User-Agent request-header field contains information about the user agent originating the request. This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests."

The User-Agent header contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

If you set a #SoupSession:user_agent property that has trailing whitespace, #SoupSession will append its own product token (eg, "libsoup/2.3.2") to the end of the header for you.

name: string

Methods

  • abort(): void
  • Cancels all pending requests in session and closes all idle persistent connections.

    The message cancellation has the same semantics as with soup_session_cancel_message(); asynchronous requests on a #SoupSessionAsync will have their callback called before soup_session_abort() returns. Requests on a plain #SoupSession will not.

    Returns void

  • Adds feature's functionality to session. You can also add a feature to the session at construct time by using the %SOUP_SESSION_ADD_FEATURE property.

    See the main #SoupSession documentation for information on what features are present in sessions by default.

    Parameters

    Returns void

  • add_feature_by_type(feature_type: GType<unknown>): void
  • If feature_type is the type of a class that implements #SoupSessionFeature, this creates a new feature of that type and adds it to session as with soup_session_add_feature(). You can use this when you don't need to customize the new feature in any way.

    If feature_type is not a #SoupSessionFeature type, this gives each existing feature on session the chance to accept feature_type as a "subfeature". This can be used to add new #SoupAuth or #SoupRequest types, for instance.

    You can also add a feature to the session at construct time by using the %SOUP_SESSION_ADD_FEATURE_BY_TYPE property.

    See the main #SoupSession documentation for information on what features are present in sessions by default.

    Parameters

    • feature_type: GType<unknown>

      a #GType

    Returns void

  • Creates a binding between source_property on source and target_property on target.

    Whenever the source_property is changed the target_property is updated using the same value. For instance:

      g_object_bind_property (action, "active", widget, "sensitive", 0);
    

    Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.

    If flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

    The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned #GBinding instance.

    Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

    A #GObject can have multiple bindings.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • target_property: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    Returns Binding

  • Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    This function is the language bindings friendly version of g_object_bind_property_full(), using #GClosures instead of function pointers.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • target_property: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    • transform_to: TClosure<any, any>

      a #GClosure wrapping the transformation function from the source to the target, or %NULL to use the default

    • transform_from: TClosure<any, any>

      a #GClosure wrapping the transformation function from the target to the source, or %NULL to use the default

    Returns Binding

  • cancel_message(msg: Soup.Message, status_code: number): void
  • Causes session to immediately finish processing msg (regardless of its current state) with a final status_code of status_code. You may call this at any time after handing msg off to session; if session has started sending the request but has not yet received the complete response, then it will close the request's connection. Note that with requests that have side effects (eg, POST, PUT, DELETE) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

    If the message is cancelled while its response body is being read, then the response body in msg will be left partially-filled-in. The response headers, on the other hand, will always be either empty or complete.

    Beware that with the deprecated #SoupSessionAsync, messages queued with soup_session_queue_message() will have their callbacks invoked before soup_session_cancel_message() returns. The plain #SoupSession does not have this behavior; cancelling an asynchronous message will merely queue its callback to be run after returning to the main loop.

    Parameters

    • msg: Soup.Message

      the message to cancel

    • status_code: number

      status code to set on msg (generally %SOUP_STATUS_CANCELLED)

    Returns void

  • check_result(request: RequestHTTP, read_bytes: object, bytes_length: number): boolean
  • Checks result of the request and sets the error if it failed. When it failed and the read_bytes is provided, then these are set to request's message response_body, thus it can be used later.

    Parameters

    • request: RequestHTTP

      a #SoupRequestHTTP

    • read_bytes: object

      optional bytes which had been read from the stream, or %NULL

    • bytes_length: number

      how many bytes had been read; ignored when read_bytes is %NULL

    Returns boolean

  • connect(sigName: "notify::credentials", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::source", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::accept-language", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::accept-language-auto", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::async-context", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::http-aliases", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::https-aliases", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::idle-timeout", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::local-address", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::max-conns", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::max-conns-per-host", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::proxy-resolver", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::proxy-uri", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::ssl-ca-file", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::ssl-strict", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::ssl-use-system-ca-file", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::timeout", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::tls-database", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::tls-interaction", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::use-ntlm", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::use-thread-context", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::user-agent", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect(sigName: string, callback: ((...args: any[]) => void)): number
  • connect_after(sigName: "notify::credentials", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::source", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::accept-language", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::accept-language-auto", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::async-context", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::http-aliases", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::https-aliases", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::idle-timeout", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::local-address", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::max-conns", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::max-conns-per-host", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::proxy-resolver", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::proxy-uri", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::ssl-ca-file", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::ssl-strict", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::ssl-use-system-ca-file", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::timeout", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::tls-database", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::tls-interaction", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::use-ntlm", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::use-thread-context", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::user-agent", callback: (($obj: SoupSession, pspec: ParamSpec) => void)): number
  • connect_after(sigName: string, callback: ((...args: any[]) => void)): number
  • Start a connection to uri. The operation can be monitored by providing a progress_callback and finishes when the connection is done or an error ocurred.

    Call soup_session_connect_finish() to get the #GIOStream to communicate with the server.

    Parameters

    Returns void

  • disconnect(id: number): void
  • emit(sigName: "notify::credentials", ...args: any[]): void
  • emit(sigName: "notify::source", ...args: any[]): void
  • emit(sigName: "notify::accept-language", ...args: any[]): void
  • emit(sigName: "notify::accept-language-auto", ...args: any[]): void
  • emit(sigName: "notify::async-context", ...args: any[]): void
  • emit(sigName: "notify::http-aliases", ...args: any[]): void
  • emit(sigName: "notify::https-aliases", ...args: any[]): void
  • emit(sigName: "notify::idle-timeout", ...args: any[]): void
  • emit(sigName: "notify::local-address", ...args: any[]): void
  • emit(sigName: "notify::max-conns", ...args: any[]): void
  • emit(sigName: "notify::max-conns-per-host", ...args: any[]): void
  • emit(sigName: "notify::proxy-resolver", ...args: any[]): void
  • emit(sigName: "notify::proxy-uri", ...args: any[]): void
  • emit(sigName: "notify::ssl-ca-file", ...args: any[]): void
  • emit(sigName: "notify::ssl-strict", ...args: any[]): void
  • emit(sigName: "notify::ssl-use-system-ca-file", ...args: any[]): void
  • emit(sigName: "notify::timeout", ...args: any[]): void
  • emit(sigName: "notify::tls-database", ...args: any[]): void
  • emit(sigName: "notify::tls-interaction", ...args: any[]): void
  • emit(sigName: "notify::use-ntlm", ...args: any[]): void
  • emit(sigName: "notify::use-thread-context", ...args: any[]): void
  • emit(sigName: "notify::user-agent", ...args: any[]): void
  • emit(sigName: string, ...args: any[]): void
  • force_floating(): void
  • This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

    Returns void

  • freeze_notify(): void
  • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

    This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

    Returns void

  • Gets session's #SoupSession:async-context. This does not add a ref to the context, so you will need to ref it yourself if you want it to outlive its session.

    For a modern #SoupSession, this will always just return the thread-default #GMainContext, and so is not especially useful.

    Returns MainContext

  • get_authentication_requires_credentials(): boolean
  • get_data(key?: string): object
  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • Optional key: string

      name of the key for that association

    Returns object

  • Gets the first feature in session of type feature_type, provided that it is not disabled for msg. As with soup_session_get_feature(), this should only be used for features where feature_type is only expected to match a single feature. In particular, if there are two matching features, and the first is disabled on msg, and the second is not, then this will return %NULL, not the second feature.

    Parameters

    • feature_type: GType<unknown>

      the #GType of the feature to get

    • msg: Soup.Message

      a #SoupMessage

    Returns Soup.SessionFeature

  • get_property(property_name?: string, value?: any): void
  • Gets a property of an object.

    The value can be:

    • an empty #GValue initialized by %G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a #GValue initialized with the expected type of the property
    • a #GValue initialized with a type to which the expected type of the property can be transformed

    In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset().

    Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.

    Parameters

    • Optional property_name: string

      the name of the property to get

    • Optional value: any

      return location for the property value

    Returns void

  • get_qdata(quark: number): object
  • getv(names: string[], values: any[]): void
  • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

    Parameters

    • names: string[]

      the names of each property to get

    • values: any[]

      the values of each property to get

    Returns void

  • has_feature(feature_type: GType<unknown>): boolean
  • Tests if session has at a feature of type feature_type (which can be the type of either a #SoupSessionFeature, or else a subtype of some class managed by another feature, such as #SoupAuth or #SoupRequest).

    Parameters

    • feature_type: GType<unknown>

      the #GType of the class of features to check for

    Returns boolean

  • is_floating(): boolean
  • new_request(method: string, uri_string?: string): RequestHTTP
  • Creates a new #SoupRequestHTTP, similar to soup_session_request_http(), but also presets request headers with "User-Agent" to be "Evolution/version" and with "Connection" to be "close".

    See also e_soup_session_new_request_uri().

    Parameters

    • method: string

      an HTTP method

    • Optional uri_string: string

      a URI string to use for the request

    Returns RequestHTTP

  • Creates a new #SoupRequestHTTP, similar to soup_session_request_http_uri(), but also presets request headers with "User-Agent" to be "Evolution/version" and with "Connection" to be "close".

    See also e_soup_session_new_request().

    Parameters

    • method: string

      an HTTP method

    • uri: Soup.URI

      a #SoupURI to use for the request

    Returns RequestHTTP

  • notify(property_name: string): void
  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    • property_name: string

      the name of a property installed on the class of object.

    Returns void

  • Emits a "notify" signal for the property specified by pspec on object.

    This function omits the property name lookup, hence it is faster than g_object_notify().

    One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

      enum
    {
    PROP_0,
    PROP_FOO,
    PROP_LAST
    };

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
    0, 100,
    50,
    G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class,
    PROP_FOO,
    properties[PROP_FOO]);
    }

    and then notify a change on the "foo" property with:

      g_object_notify_by_pspec (self, properties[PROP_FOO]);
    

    Parameters

    • pspec: ParamSpec

      the #GParamSpec of a property installed on the class of object.

    Returns void

  • Pauses HTTP I/O on msg. Call soup_session_unpause_message() to resume I/O.

    This may only be called for asynchronous messages (those sent on a #SoupSessionAsync or using soup_session_queue_message()).

    Parameters

    • msg: Soup.Message

      a #SoupMessage currently running on session

    Returns void

  • Tells session 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.

    If cancellable is non-%NULL, it can be used to cancel the resolution. callback will still be invoked in this case, with a status of %SOUP_STATUS_CANCELLED.

    Parameters

    • hostname: string

      a hostname to be resolved

    • cancellable: Gio.Cancellable

      a #GCancellable object, or %NULL

    • callback: AddressCallback

      callback to call with the result, or %NULL

    Returns void

  • prepare_for_uri(uri: Soup.URI): void
  • Tells session that uri may be requested shortly, and so the session can try to prepare (resolving the domain name, obtaining proxy address, etc.) in order to work more quickly once the URI is actually requested.

    Parameters

    • uri: Soup.URI

      a #SoupURI which may be required

    Returns void

  • Queues the message msg for asynchronously sending the request and receiving a response in the current thread-default #GMainContext. If msg has been processed before, any resources related to the time it was last sent are freed.

    Upon message completion, the callback specified in callback will be invoked. If after returning from this callback the message has not been requeued, msg will be unreffed.

    (The behavior above applies to a plain #SoupSession; if you are using #SoupSessionAsync or #SoupSessionSync, then the #GMainContext that is used depends on the settings of #SoupSession:async-context and #SoupSession:use-thread-context, and for #SoupSessionSync, the message will actually be sent and processed in another thread, with only the final callback occurring in the indicated #GMainContext.)

    Contrast this method with soup_session_send_async(), which also asynchronously sends a message, but returns before reading the response body, and allows you to read the response via a #GInputStream.

    Parameters

    • msg: Soup.Message

      the message to queue

    • callback: Soup.SessionCallback

      a #SoupSessionCallback which will be called after the message completes or when an unrecoverable error occurs.

    Returns void

  • Updates msg's URI according to its status code and "Location" header, and requeues it on session. Use this when you have set %SOUP_MESSAGE_NO_REDIRECT on a message, but have decided to allow a particular redirection to occur, or if you want to allow a redirection that #SoupSession will not perform automatically (eg, redirecting a non-safe method such as DELETE).

    If msg's status code indicates that it should be retried as a GET request, then msg will be modified accordingly.

    If msg has already been redirected too many times, this will cause it to fail with %SOUP_STATUS_TOO_MANY_REDIRECTS.

    Parameters

    • msg: Soup.Message

      a #SoupMessage that has received a 3xx response

    Returns boolean

  • Increases the reference count of object.

    Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

    Returns GObject.Object

  • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

    In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

    Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

    Returns GObject.Object

  • remove_feature_by_type(feature_type: GType<unknown>): void
  • Removes all features of type feature_type (or any subclass of feature_type) from session. You can also remove standard features from the session at construct time by using the %SOUP_SESSION_REMOVE_FEATURE_BY_TYPE property.

    Parameters

    • feature_type: GType<unknown>

      a #GType

    Returns void

  • request(uri_string: string): Request
  • request_http(method: string, uri_string: string): RequestHTTP
  • Creates a #SoupRequest for retrieving uri_string, which must be an "http" or "https" URI (or another protocol listed in session's #SoupSession:http-aliases or #SoupSession:https-aliases).

    Parameters

    • method: string

      an HTTP method

    • uri_string: string

      a URI, in string form

    Returns RequestHTTP

  • Creates a #SoupRequest for retrieving uri, which must be an "http" or "https" URI (or another protocol listed in session's #SoupSession:http-aliases or #SoupSession:https-aliases).

    Parameters

    • method: string

      an HTTP method

    • uri: Soup.URI

      a #SoupURI representing the URI to retrieve

    Returns RequestHTTP

  • run_dispose(): void
  • Synchronously sends msg and waits for the beginning of a response. On success, a #GInputStream will be returned which you can use to read the response body. ("Success" here means only that an HTTP response was received and understood; it does not necessarily mean that a 2xx class status code was received.)

    If non-%NULL, cancellable can be used to cancel the request; soup_session_send() will return a %G_IO_ERROR_CANCELLED error. Note that with requests that have side effects (eg, POST, PUT, DELETE) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

    If msg is requeued due to a redirect or authentication, the initial (3xx/401/407) response body will be suppressed, and soup_session_send() will only return once a final response has been received.

    Contrast this method with soup_session_send_message(), which also synchronously sends a #SoupMessage, but doesn't return until the response has been completely read.

    (Note that this method cannot be called on the deprecated #SoupSessionAsync subclass.)

    Parameters

    Returns Gio.InputStream

  • Asynchronously sends msg and waits for the beginning of a response. When callback is called, then either msg has been sent, and its response headers received, or else an error has occurred. Call soup_session_send_finish() to get a #GInputStream for reading the response body.

    See soup_session_send() for more details on the general semantics.

    Contrast this method with soup_session_queue_message(), which also asynchronously sends a #SoupMessage, but doesn't invoke its callback until the response has been completely read.

    (Note that this method cannot be called on the deprecated #SoupSessionSync subclass, and can only be called on #SoupSessionAsync if you have set the #SoupSession:use-thread-context property.)

    Parameters

    Returns void

  • Synchronously send msg. This call will not return until the transfer is finished successfully or there is an unrecoverable error.

    Unlike with soup_session_queue_message(), msg is not freed upon return.

    (Note that if you call this method on a #SoupSessionAsync, it will still use asynchronous I/O internally, running the glib main loop to process the message, which may also cause other events to be processed.)

    Contrast this method with soup_session_send(), which also synchronously sends a message, but returns before reading the response body, and allows you to read the response via a #GInputStream.

    Parameters

    Returns number

  • Similar to e_soup_session_send_request_sync(), except it reads whole response content into memory and returns it as a #GByteArray. Use e_soup_session_send_request_sync() when you want to have more control on the content read.

    The function prints read content to stdout when e_soup_session_get_log_level() returns #SOUP_LOGGER_LOG_BODY.

    Parameters

    Returns Uint8Array

  • Synchronously sends prepared request and returns #GInputStream that can be used to read its contents.

    This calls soup_request_send() internally, but it also setups the request according to #ESoupSession:source authentication settings. It also extracts information about used certificate, in case of SOUP_STATUS_SSL_FAILED error and keeps it for later use by e_soup_session_get_ssl_error_details().

    Use e_soup_session_send_request_simple_sync() to read whole content into a #GByteArray.

    Note that SoupSession doesn't log content read from GInputStream, thus the caller may print the read content on its own when needed.

    Note the request is fully filled only after there is anything read from the resulting #GInputStream, thus use e_soup_session_check_result() to verify that the receive had been finished properly.

    Parameters

    Returns Gio.InputStream

  • set_data(key: string, data?: object): void
  • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

    If the object already had an association with that name, the old association will be destroyed.

    Internally, the key is converted to a #GQuark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the #GQuark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optional data: object

      data to associate with that key

    Returns void

  • set_property(property_name: string, value?: any): void
  • setup_logging(logging_level: string): void
  • Setups logging for the session. The logging_level can be one of: "all" - log whole raw communication; "body" - the same as "all"; "headers" - log the headers only; "min" - minimal logging; "1" - the same as "all". Any other value, including %NULL, disables logging.

    Use e_soup_session_get_log_level() to get current log level.

    Parameters

    • logging_level: string

      logging level to setup, or %NULL

    Returns void

  • "Steals" the HTTP connection associated with msg from session. This happens immediately, regardless of the current state of the connection, and msg's callback will not be called. You can steal the connection from a #SoupMessage signal handler if you need to wait for part or all of the response to be received first.

    Calling this function may cause msg to be freed if you are not holding any other reference to it.

    Parameters

    • msg: Soup.Message

      the message whose connection is to be stolen

    Returns IOStream

  • steal_data(key?: string): object
  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • Optional key: string

      name of the key

    Returns object

  • steal_qdata(quark: number): object
  • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

    void
    object_add_to_user_list (GObject *object,
    const gchar *new_string)
    {
    // the quark, naming the object data
    GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
    // retrieve the old string list
    GList *list = g_object_steal_qdata (object, quark_string_list);

    // prepend new string
    list = g_list_prepend (list, g_strdup (new_string));
    // this changed 'list', so we need to set it again
    g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
    }
    static void
    free_string_list (gpointer data)
    {
    GList *node, *list = data;

    for (node = list; node; node = node->next)
    g_free (node->data);
    g_list_free (list);
    }

    Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    Returns object

  • thaw_notify(): void
  • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

    Duplicate notifications for each property are squashed so that at most one #GObject::notify signal is emitted for each property, in the reverse order in which they have been queued.

    It is an error to call this function when the freeze count is zero.

    Returns void

  • Resumes HTTP I/O on msg. Use this to resume after calling soup_session_pause_message().

    If msg is being sent via blocking I/O, this will resume reading or writing immediately. If msg is using non-blocking I/O, then reading or writing won't resume until you return to the main loop.

    This may only be called for asynchronous messages (those sent on a #SoupSessionAsync or using soup_session_queue_message()).

    Parameters

    • msg: Soup.Message

      a #SoupMessage currently running on session

    Returns void

  • unref(): void
  • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

    If the pointer to the #GObject may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to %NULL rather than retain a dangling pointer to a potentially invalid #GObject instance. Use g_clear_object() for this.

    Returns void

  • vfunc_cancel_message(msg: Soup.Message, status_code: number): void
  • Causes session to immediately finish processing msg (regardless of its current state) with a final status_code of status_code. You may call this at any time after handing msg off to session; if session has started sending the request but has not yet received the complete response, then it will close the request's connection. Note that with requests that have side effects (eg, POST, PUT, DELETE) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

    If the message is cancelled while its response body is being read, then the response body in msg will be left partially-filled-in. The response headers, on the other hand, will always be either empty or complete.

    Beware that with the deprecated #SoupSessionAsync, messages queued with soup_session_queue_message() will have their callbacks invoked before soup_session_cancel_message() returns. The plain #SoupSession does not have this behavior; cancelling an asynchronous message will merely queue its callback to be run after returning to the main loop.

    virtual

    Parameters

    • msg: Soup.Message

      the message to cancel

    • status_code: number

      status code to set on msg (generally %SOUP_STATUS_CANCELLED)

    Returns void

  • vfunc_constructed(): void
  • vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: ParamSpec): void
  • vfunc_dispose(): void
  • vfunc_finalize(): void
  • vfunc_flush_queue(): void
  • vfunc_get_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • vfunc_kick(): void
  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    virtual

    Parameters

    Returns void

  • Queues the message msg for asynchronously sending the request and receiving a response in the current thread-default #GMainContext. If msg has been processed before, any resources related to the time it was last sent are freed.

    Upon message completion, the callback specified in callback will be invoked. If after returning from this callback the message has not been requeued, msg will be unreffed.

    (The behavior above applies to a plain #SoupSession; if you are using #SoupSessionAsync or #SoupSessionSync, then the #GMainContext that is used depends on the settings of #SoupSession:async-context and #SoupSession:use-thread-context, and for #SoupSessionSync, the message will actually be sent and processed in another thread, with only the final callback occurring in the indicated #GMainContext.)

    Contrast this method with soup_session_send_async(), which also asynchronously sends a message, but returns before reading the response body, and allows you to read the response via a #GInputStream.

    virtual

    Parameters

    • msg: Soup.Message

      the message to queue

    • callback: Soup.SessionCallback

      a #SoupSessionCallback which will be called after the message completes or when an unrecoverable error occurs.

    Returns void

  • Synchronously send msg. This call will not return until the transfer is finished successfully or there is an unrecoverable error.

    Unlike with soup_session_queue_message(), msg is not freed upon return.

    (Note that if you call this method on a #SoupSessionAsync, it will still use asynchronous I/O internally, running the glib main loop to process the message, which may also cause other events to be processed.)

    Contrast this method with soup_session_send(), which also synchronously sends a message, but returns before reading the response body, and allows you to read the response via a #GInputStream.

    virtual

    Parameters

    Returns number

  • vfunc_set_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • watch_closure(closure: TClosure<any, any>): void
  • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

    Parameters

    • closure: TClosure<any, any>

      #GClosure to watch

    Returns void

  • Asynchronously creates a #SoupWebsocketConnection to communicate with a remote server.

    All necessary WebSocket-related headers will be added to msg, and it will then be sent and asynchronously processed normally (including handling of redirection and HTTP authentication).

    If the server returns "101 Switching Protocols", then msg's status code and response headers will be updated, and then the WebSocket handshake will be completed. On success, soup_session_websocket_connect_finish() will return a new #SoupWebsocketConnection. On failure it will return a #GError.

    If the server returns a status other than "101 Switching Protocols", then msg will contain the complete response headers and body from the server's response, and soup_session_websocket_connect_finish() will return %SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET.

    Parameters

    • msg: Soup.Message

      #SoupMessage indicating the WebSocket server to connect to

    • origin: string

      origin of the connection

    • protocols: string[]

      a %NULL-terminated array of protocols supported

    • cancellable: Gio.Cancellable

      a #GCancellable

    • callback: AsyncReadyCallback

      the callback to invoke

    Returns void

  • Checks if msg contains a response that would cause session to redirect it to a new URL (ignoring msg's %SOUP_MESSAGE_NO_REDIRECT flag, and the number of times it has already been redirected).

    Parameters

    • msg: Soup.Message

      a #SoupMessage that has response headers

    Returns boolean

  • compat_control(what: number, data: object): number
  • Find the #GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    • property_name: string

      name of a property to look up.

    Returns ParamSpec

  • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created #GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

    This function is meant to be called from the interface's default vtable initialization function (the class_init member of #GTypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

    If pspec is a floating reference, it will be consumed.

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface.

    • pspec: ParamSpec

      the #GParamSpec for the new property

    Returns void

  • Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    Returns ParamSpec[]

  • Creates a new instance of a #GObject subtype and sets its properties.

    Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.

    Parameters

    • object_type: GType<unknown>

      the type id of the #GObject subtype to instantiate

    • parameters: GObject.Parameter[]

      an array of #GParameter

    Returns GObject.Object

  • util_normalize_uri_path(suri: Soup.URI): boolean
  • Normalizes the path of the suri, aka encodes characters, which should be encoded, if needed. Returns, whether any change had been made to the path. It doesn't touch other parts of the suri.

    Parameters

    • suri: Soup.URI

      a #SoupURI to normalize the path for

    Returns boolean

  • util_status_to_string(status_code: number, reason_phrase: string): string
  • Returns the reason_phrase, if it's non-%NULL and non-empty, a static string corresponding to status_code. In case neither that can be found a localized "Unknown error" message is returned.

    Parameters

    • status_code: number

      an HTTP status code

    • reason_phrase: string

      preferred string to use for the message, or %NULL

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method