Class
SoupMessage
Description [src]
final class Soup.Message : GObject.Object {
/* No available fields */
}
Represents an HTTP message being sent or received.
A SoupMessage
represents an HTTP message that is being sent or received.
You would create a SoupMessage
with soup_message_new()
or
soup_message_new_from_uri()
, set up its fields appropriately, and send it.
SoupMessage:status-code
will normally be a SoupStatus
value, eg,
SOUP_STATUS_OK
, though of course it might actually be an unknown status
code. SoupMessage: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
SoupMessage:reason-phrase
in user-visible messages. Rather, you should
look at SoupMessage:status-code
, and determine an end-user-appropriate
message based on that and on what you were trying to do.
Note that libsoup’s terminology here does not quite match the HTTP
specification: in RFC 2616, an “HTTP-message” is either a Request, or a
Response. In libsoup, a SoupMessage
combines both the request and the response.
Constructors
soup_message_new_from_encoded_form
Creates a new SoupMessage
and sets it up to send the given encoded_form
to uri
via method
. If method
is “GET”, it will include the form data
into uri
‘s query field, and if method
is “POST” or “PUT”, it will be set as
request body.
soup_message_new_from_multipart
Creates a new SoupMessage
and sets it up to send multipart
to
uri_string
via POST.
soup_message_new_options_ping
Creates a new SoupMessage
to send OPTIONS *
to a server. The path of
base_uri
will be ignored.
Instance methods
soup_message_disable_feature
Disables the actions of SoupSessionFeature
s with the
given feature_type
(or a subclass of that type) on msg
.
soup_message_get_force_http1
Returns whether HTTP/1 version is currently demanded for the msg
send.
since: 3.4
soup_message_get_is_options_ping
Gets whether msg
is intended to be used to send OPTIONS *
to a server.
soup_message_get_remote_address
Get the remote GSocketAddress
of the connection associated with
the message.
soup_message_get_tls_ciphersuite_name
Gets the name of the TLS ciphersuite negotiated for msg
‘s connection.
soup_message_get_tls_peer_certificate
Gets the peer’s GTlsCertificate
associated with msg
‘s connection.
soup_message_get_tls_peer_certificate_errors
Gets the errors associated with validating msg
‘s TLS peer certificate.
Note that this is not set yet during the emission of
SoupMessage::accept-certificate
signal.
soup_message_get_tls_protocol_version
Gets the TLS protocol version negotiated for msg
‘s connection.
soup_message_is_feature_disabled
Get whether SoupSessionFeature
s of the given feature_type
(or a subclass of that type) are disabled on msg
.
soup_message_is_keepalive
Determines whether or not msg
‘s connection can be kept alive for
further requests after processing msg
.
soup_message_set_force_http1
Sets whether HTTP/1 version should be used when sending this message. Some connections can still override it, if needed.
since: 3.4
soup_message_set_is_options_ping
Set whether msg
is intended to be used to send OPTIONS *
to a server.
soup_message_set_is_top_level_navigation
Sets whether the current request is a top-level navitation.
soup_message_set_site_for_cookies
Sets site_for_cookies
as the policy URL for same-site cookies for msg
.
soup_message_set_tls_client_certificate
Sets the certificate
to be used by msg
‘s connection when a
client certificate is requested during the TLS handshake.
soup_message_tls_client_certificate_password_request_complete
Completes a certificate password request.
Properties
Soup.Message:priority
Sets the priority of the SoupMessage
. See
soup_message_set_priority()
for further details.
Soup.Message:remote-address
The remote GSocketAddress
of the connection associated
with the message.
Soup.Message:site-for-cookies
Site used to compare cookies against. Used for SameSite cookie support.
Soup.Message:tls-ciphersuite-name
The Name of TLS ciphersuite negotiated for this message connection.
Soup.Message:tls-peer-certificate-errors
The verification errors on SoupMessage:tls-peer-certificate
.
Signals
Soup.Message::accept-certificate
Emitted during the msg
‘s connection TLS handshake
after an unacceptable TLS certificate has been received.
Soup.Message::got-body-data
Emitted after reading a portion of the message body from the network.
since: 3.4
Soup.Message::got-informational
Emitted after receiving a 1xx (Informational) response for a (client-side) message.
Soup.Message::hsts-enforced
Emitted when SoupHSTSEnforcer
has upgraded the protocol
for msg
to HTTPS as a result of matching its domain with
a HSTS policy.
Soup.Message::network-event
Emitted to indicate that some network-related event
related to msg
has occurred.
Soup.Message::request-certificate
Emitted during the msg
‘s connection TLS handshake when
tls_connection
requests a certificate from the client.
Soup.Message::request-certificate-password
Emitted during the msg
‘s connection TLS handshake when
tls_connection
requests a certificate password from the client.
Soup.Message::wrote-body-data
Emitted immediately after writing a portion of the message body to the network.
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.