![]() |
![]() |
![]() |
libsoup Reference Manual | ![]() |
---|---|---|---|---|
void soup_session_queue_message (SoupSession *session, SoupMessage *msg, SoupMessageCallbackFn callback, gpointer user_data); void soup_session_requeue_message (SoupSession *session, SoupMessage *msg); guint soup_session_send_message (SoupSession *session, SoupMessage *msg); void soup_session_abort (SoupSession *session); void soup_session_add_filter (SoupSession *session, SoupMessageFilter *filter); void soup_session_cancel_message (SoupSession *session, SoupMessage *msg); SoupConnection* soup_session_get_connection (SoupSession *session, SoupMessage *msg, gboolean *try_pruning, gboolean *is_new); void soup_session_remove_filter (SoupSession *session, SoupMessageFilter *filter); gboolean soup_session_try_prune_connection (SoupSession *session); #define SOUP_SESSION_PROXY_URI #define SOUP_SESSION_MAX_CONNS #define SOUP_SESSION_MAX_CONNS_PER_HOST #define SOUP_SESSION_USE_NTLM #define SOUP_SESSION_SSL_CA_FILE #define SOUP_SESSION_ASYNC_CONTEXT #define SOUP_SESSION_TIMEOUT
void soup_session_queue_message (SoupSession *session, SoupMessage *msg, SoupMessageCallbackFn callback, gpointer user_data);
Queues the message msg
for sending. All messages are processed
while the glib main loop runs. 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 (in the thread associated with session
's async
context). If after returning from this callback the message has not
been requeued, msg
will be unreffed.
|
a SoupSession |
|
the message to queue |
|
a SoupMessageCallbackFn which will be called after the message completes or when an unrecoverable error occurs. |
|
a pointer passed to callback .
|
void soup_session_requeue_message (SoupSession *session, SoupMessage *msg);
This causes msg
to be placed back on the queue to be attempted
again.
|
a SoupSession |
|
the message to requeue |
guint soup_session_send_message (SoupSession *session, SoupMessage *msg);
Synchronously send msg
. This call will not return until the
transfer is finished successfully or there is an unrecoverable
error.
msg
is not freed upon return.
|
a SoupSession |
|
the message to send |
Returns : |
the HTTP status code of the response |
void soup_session_abort (SoupSession *session);
Cancels all pending requests in session
.
|
the session |
void soup_session_add_filter (SoupSession *session, SoupMessageFilter *filter);
Adds filter
to session
's list of message filters to be applied to
all messages.
|
a SoupSession |
|
an object implementing the SoupMessageFilter interface |
void soup_session_cancel_message (SoupSession *session, SoupMessage *msg);
Causes session
to immediately finish processing msg
. You should
set a status code on msg
with soup_message_set_status()
before
calling this function.
|
a SoupSession |
|
the message to cancel |
SoupConnection* soup_session_get_connection (SoupSession *session, SoupMessage *msg, gboolean *try_pruning, gboolean *is_new);
Tries to find or create a connection for msg
; this is an internal
method for SoupSession subclasses.
If there is an idle connection to the relevant host available, then
that connection will be returned (with *is_new
set to FALSE
). The
connection will be marked "reserved", so the caller must call
soup_connection_release()
if it ends up not using the connection
right away.
If there is no idle connection available, but it is possible to
create a new connection, then one will be created and returned,
with *is_new
set to TRUE
. The caller MUST then call
soup_connection_connect_sync()
or soup_connection_connect_async()
to connect it. If the connection attempt succeeds, the connection
will be marked "reserved" and added to session
's connection pool
once it connects. If the connection attempt fails, the connection
will be unreffed.
If no connection is available and a new connection cannot be made,
soup_session_get_connection()
will return NULL
. If session
has
the maximum number of open connections open, but does not have the
maximum number of per-host connections open to the relevant host,
then *try_pruning
will be set to TRUE
. In this case, the caller
can call soup_session_try_prune_connection()
to close an idle
connection, and then try soup_session_get_connection()
again. (If
calling soup_session_try_prune_connection()
wouldn't help, then
*try_pruning
is left untouched; it is NOT set to FALSE
.)
|
a SoupSession |
|
a SoupMessage |
|
on return, whether or not to try pruning a connection |
|
on return, TRUE if the returned connection is new and not
yet connected
|
Returns : |
a SoupConnection, or NULL
|
void soup_session_remove_filter (SoupSession *session, SoupMessageFilter *filter);
Removes filter
from session
's list of message filters
|
a SoupSession |
|
an object implementing the SoupMessageFilter interface |
gboolean soup_session_try_prune_connection (SoupSession *session);
Finds the least-recently-used idle connection in session
and closes
it.
|
a SoupSession |
Returns : |
TRUE if a connection was closed, FALSE if there are
no idle connections.
|
#define SOUP_SESSION_PROXY_URI "proxy-uri"
An alias for the "proxy-uri" property.
#define SOUP_SESSION_MAX_CONNS "max-conns"
An alias for the "max-conns" property.
#define SOUP_SESSION_MAX_CONNS_PER_HOST "max-conns-per-host"
An alias for the "max-conns-per-host" property.
#define SOUP_SESSION_USE_NTLM "use-ntlm"
An alias for the "use-ntlm" property.
#define SOUP_SESSION_SSL_CA_FILE "ssl-ca-file"
An alias for the "ssl-ca-file" property.
#define SOUP_SESSION_ASYNC_CONTEXT "async-context"
An alias for the "async-context" property.