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.
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.
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.
Sets the #GInetSocketAddress 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.
The maximum number of connections that the session can open at once.
The maximum number of connections that the session can open at once to a given host.
A #GProxyResolver to use with this session.
If no proxy resolver is set, then the default proxy resolver will be used. See g_proxy_resolver_get_default(). 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.
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.
This function is not required for common HTTP usage, but only when connecting to a HTTP service that is not using standard TCP/IP sockets. An example of this is a local service that uses HTTP over UNIX-domain sockets, in that case a #GUnixSocketAddress can be passed to this function.
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.
Not to be confused with #SoupSession:idle-timeout (which is the length of time that idle persistent connections will be kept open).
Sets the #GTlsDatabase to use for validating SSL/TLS certificates.
If no certificate database is set, then the default database will be used. See g_tls_backend_get_default_database().
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.)
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, "
Cancels all pending requests in session
and closes all idle
persistent connections.
Adds feature'
s functionality to session
. You cannot add multiple
features of the same #GType to a session.
See the main #SoupSession documentation for information on what features are present in sessions by default.
an object that implements #SoupSessionFeature
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.
Adding multiple features of the same feature_type
is not allowed.
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 types, for instance.
See the main #SoupSession documentation for information on what features are present in sessions by default.
a #GType
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.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
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.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
a #GClosure wrapping the transformation function from the source
to the target,
or %NULL to use the default
a #GClosure wrapping the transformation function from the target
to the source,
or %NULL to use the default
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().
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.
Get the value used by session
for the "Accept-Language" header on new requests.
Get whether session
automatically sets the "Accept-Language" header on new requests.
Gets the #SoupMessage of the result
asynchronous operation
This is useful to get the #SoupMessage of an asynchronous
operation started by session
from its #GAsyncReadyCallback.
the #GAsyncResult passed to your callback
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
Gets the feature in session
of type feature_type
.
the #GType of the feature to get
Gets the feature in session
of type feature_type,
provided
that it is not disabled for msg
.
Get the timeout in seconds for idle connection lifetime currently used by session
.
Get the #GInetSocketAddress to use for the client side of connections in session
.
Get the maximum number of connections that session
can open at once.
Get the maximum number of connections that session
can open at once to a given host.
Gets a property of an object.
The value
can be:
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.
the name of the property to get
return location for the property value
Get the #GProxyResolver currently used by session
.
This function gets back user data pointers stored via g_object_set_qdata().
A #GQuark, naming the user data pointer
Get the remote connectable if one set.
Get the timeout in seconds for socket I/O operations currently used by session
.
Get the #GTlsDatabase currently used by session
.
Get the #GTlsInteraction currently used by session
.
Get the value used by session
for the "User-Agent" header on new requests.
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.
the names of each property to get
the values of each property to get
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).
the #GType of the class of features to check for
Checks whether object
has a [floating][floating-ref] reference.
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.
the name of a property installed on the class of object
.
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]);
the #GParamSpec of a property installed on the class of object
.
Start a preconnection to msg
. Once the connection is done, it will remain in idle state so that
it can be reused by future requests. If there's already an idle connection for the given msg
host, the operation finishes successfully without creating a new connection. If a new request
for the given msg
host is made while the preconnect is still ongoing, the request will take
the ownership of the connection and the preconnect operation will finish successfully (if
there's a connection error it will be handled by the request).
The operation finishes when the connection is done or an error occurred.
a #SoupMessage
the I/O priority of the request
a #GCancellable
the callback to invoke when the operation finishes
Complete a preconnect async operation started with soup_session_preconnect_async().
the #GAsyncResult passed to your callback
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().
Removes feature'
s functionality from session
.
a feature that has previously been added to session
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
SoupSession:remove-feature-by-type property.
a #GType
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from object system implementations.
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,
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.
a #SoupMessage
a #GCancellable
Synchronously sends msg
and reads the response body.
On success, a #GBytes will be returned with the response body.
This function should only be used when the resource to be retrieved
is not too long and can be stored in memory.
See soup_session_send() for more details on the general semantics.
a #SoupMessage
a #GCancellable
Asynchronously sends msg
and reads the response body.
When callback
is called, then either msg
has been sent, and its response
body read, or else an error has occurred.
This function should only be used when the resource to be retrieved
is not too long and can be stored in memory.
Call soup_session_send_and_read_finish() to get a #GBytes with the
response body.
See soup_session_send() for more details on the general semantics.
a #SoupMessage
the I/O priority of the request
a #GCancellable
the callback to invoke
Gets the response to a soup_session_send_and_read_async() call and (if successful), returns a #GBytes with the response body.
the #GAsyncResult passed to your callback
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.
a #SoupMessage
the I/O priority of the request
a #GCancellable
the callback to invoke
Gets the response to a soup_session_send_async() call and (if successful), returns a #GInputStream that can be used to read the response body.
the #GAsyncResult passed to your callback
Set the value to use for the "Accept-Language" header on #SoupMessages sent from session
.
If accept_language
is %NULL then no "Accept-Language" will be included in requests. See #SoupSession:accept-language
for more information.
the languages string
Set whether session
will automatically set the "Accept-Language" header on requests using
a value generated from system languages based on g_get_language_names(). See #SoupSession:accept-language-auto
for more information.
the value to set
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.
name of the key
data to associate with that key
Set a timeout in seconds for idle connection lifetime to be used by session
on new connections. See #SoupSession:idle-timeout for more information.
a timeout in seconds
Sets a property on an object.
the name of the property to set
the value
Set a #GProxyResolver to be used by session
on new connections. If proxy_resolver
is %NULL then no proxies will be used. See #SoupSession:proxy-resolver for more information.
a #GProxyResolver or %NULL
Set a timeout in seconds for socket I/O operations to be used by session
on new connections. See #SoupSession:timeout for more information.
a timeout in seconds
Set a #GTlsDatabase to be used by session
on new connections. If tls_database
is %NULL then certificate validation will always fail. See #SoupSession:tls-database
for more information.
a #GTlsDatabase or %NULL
Set a #GTlsInteraction to be used by session
on new connections. If tls_interaction
is %NULL then client certificate validation will always fail. See #SoupSession:tls-interaction
for more information.
a #GTlsInteraction or %NULL
Set the value to use for the "User-Agent" header on #SoupMessages sent from session
.
If user_agent
has trailing whitespace, session
will append its own product token
(eg, "user_agent
is %NULL then no "User-Agent" will be included in requests. See #SoupSession:user-agent
for more information.
the user agent string
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
name of the key
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().
A #GQuark, naming the user data pointer
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.
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.
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.
#GClosure to watch
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.
#SoupMessage indicating the WebSocket server to connect to
origin of the connection
a %NULL-terminated array of protocols supported
the I/O priority of the request
a #GCancellable
the callback to invoke
Gets the #SoupWebsocketConnection response to a soup_session_websocket_connect_async() call and (if successful), returns a #SoupWebsocketConnection that can be used to communicate with the server.
the #GAsyncResult passed to your callback
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().
any interface vtable for the interface, or the default vtable for the interface
name of a property to look up.
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.
any interface vtable for the interface, or the default vtable for the interface.
the #GParamSpec for the new property
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().
any interface vtable for the interface, or the default vtable for the interface
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.
the type id of the #GObject subtype to instantiate
an array of #GParameter
Class managing options and state for #SoupMessages.