Represents an HTTP message being sent or received.
status_code will normally be a KnownStatusCode, eg,
OK, though of course it might actually be an unknown status code.
reason_phrase is the actual text returned from the server, which may or may not correspond to the "standard" description of
status_code. At any rate, it is almost certainly not localized, and not very descriptive even if it is in the user's
language; you should not use reason_phrase in user-visible messages. Rather, you should look at status_code, and
determine an end-user-appropriate message based on that and on what you were trying to do.
As described in the MessageBody documentation, the request_body and
response_body data fields will not necessarily be filled in at all times. When they are filled in, they will be terminated
with a '\0' byte (which is not included in the length), so you can use them as ordinary C strings (assuming that you know that the
body doesn't have any other '\0' bytes).
For a client-side Message, request_body's data is usually filled
in right before libsoup writes the request to the network, but you should not count on this; use
flatten if you want to ensure that data is filled in.
response_body's data will be filled in before finished is
emitted.
For a server-side Message, request_body's data will be filled in
before got_body is emitted.
To prevent the data field from being filled in at all (eg, if you are handling the data from a
got_chunk, and so don't need to see it all at the end), call
set_accumulate on response_body or request_body
as appropriate, passing false.
-
public void content_sniffed (string object, HashTable<void*,void*> p0)
This signal is emitted after got_headers, and
before the first got_chunk. If content sniffing is disabled, or no content
sniffing will be performed, due to the sniffer deciding to trust the Content-Type sent by the server, this signal is emitted
immediately after got_headers, and type is null.
-
public virtual void finished ()
Emitted when all HTTP processing is finished for a message. (After
got_body for client-side messages, or after
wrote_body for server-side messages.)
-
public virtual void got_body ()
Emitted after receiving the complete message body. (For a server-side message, this means it has
received the request body. For a client-side message, this means it has received the response body and is nearly done with the
message.)
-
public virtual void got_chunk (Buffer chunk)
Emitted after receiving a chunk of a message body. Note that "chunk" in this context means any subpiece
of the body, not necessarily the specific HTTP 1.1 chunks sent by the other side.
-
public virtual void got_headers ()
Emitted after receiving all message headers for a message. (For a client-side message, this is after
receiving the Status-Line and response headers; for a server-side message, it is after receiving the Request-Line and request
headers.)
-
public virtual void got_informational ()
Emitted after receiving a 1xx (Informational) response for a (client-side) message. The response_headers
will be filled in with the headers associated with the informational response; however, those header values will be erased after this
signal is done.
-
public virtual void restarted ()
Emitted when a request that was already sent once is now being sent again (eg, because the first attempt
received a redirection response, or because we needed to use authentication).
-
public virtual void wrote_body ()
Emitted immediately after writing the complete body for a message. (For a client-side message, this
means that libsoup is done writing and is now waiting for the response from the server. For a server-side message, this means that
libsoup has finished writing the response and is nearly done with the message.)
-
public void wrote_body_data (Buffer object)
Emitted immediately after writing a portion of the message body to the network.
-
public virtual void wrote_chunk ()
Emitted immediately after writing a body chunk for a message.
-
public virtual void wrote_headers ()
Emitted immediately after writing the headers for a message. (For a client-side message, this is after
writing the request headers; for a server-side message, it is after writing the response headers.)
-
public virtual void wrote_informational ()
Emitted immediately after writing a 1xx (Informational) response for a (server-side) message.