Session.cancelMessage

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, <literal>POST</literal>, <literal>PUT</literal>, <literal>DELETE</literal>) 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.

class Session
void
cancelMessage

Parameters

msg Message

the message to cancel

statusCode uint

status code to set on @msg (generally %SOUP_STATUS_CANCELLED)

Meta