Soup.ServerMessage
Description: Reference for Soup.ServerMessage

### Class

# SoupServerMessage

#### Description [src]

    final class Soup.ServerMessage : GObject.Object {
      /* No available fields */
    }

An HTTP server request and response pair.

A SoupServerMessage represents an HTTP message that is being sent or received on a `SoupServer`.

`SoupServer` will create `SoupServerMessage`s automatically for incoming requests, which your application will receive via handlers.

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 `SoupServerMessage` combines both the request and the response.

#### Hierarchy

#### Ancestors

- GObject

#### Instance methods

###### soup_server_message_get_http_version

Get the HTTP version of `msg`.

###### soup_server_message_get_local_address

Retrieves the `GSocketAddress` associated with the local end of a connection.

###### soup_server_message_get_method

Get the HTTP method of `msg`.

###### soup_server_message_get_reason_phrase

Get the HTTP reason phrase of `msg`.

###### soup_server_message_get_remote_address

Retrieves the `GSocketAddress` associated with the remote end of a connection.

###### soup_server_message_get_remote_host

Retrieves the IP address associated with the remote end of a connection.

###### soup_server_message_get_request_body

Get the request body of `msg`.

###### soup_server_message_get_request_headers

Get the request headers of `msg`.

###### soup_server_message_get_response_body

Get the response body of `msg`.

###### soup_server_message_get_response_headers

Get the response headers of `msg`.

###### soup_server_message_get_socket

Retrieves the `GSocket` that `msg` is associated with.

###### soup_server_message_get_status

Get the HTTP status code of `msg`.

###### soup_server_message_get_tls_peer_certificate

Gets the peer’s `GTlsCertificate` associated with `msg`‘s connection. Note that this is not set yet during the emission of SoupServerMessage::accept-certificate signal.

since: 3.2

###### soup_server_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 SoupServerMessage::accept-certificate signal.

since: 3.2

###### soup_server_message_get_uri

Get `msg`‘s URI.

###### soup_server_message_is_options_ping

Gets if `msg` represents an OPTIONS message with the path `*`.

###### soup_server_message_pause

Pauses I/O on `msg`.

since: 3.2

###### soup_server_message_set_http_version

Set the HTTP version of `msg`.

###### soup_server_message_set_redirect

Sets `msg`‘s status_code to `status_code` and adds a Location header pointing to `redirect_uri`. Use this from a `SoupServer` when you want to redirect the client to another URI.

###### soup_server_message_set_response

Convenience function to set the response body of a `SoupServerMessage`. If `content_type` is `NULL`, the response body must be empty as well.

###### soup_server_message_set_status

Sets `msg`‘s status code to `status_code`.

###### soup_server_message_steal_connection

“Steals” the HTTP connection associated with `msg` from its `SoupServer`. This happens immediately, regardless of the current state of the connection; if the response to `msg` has not yet finished being sent, then it will be discarded; you can steal the connection from a `SoupServerMessage::wrote-informational` or `SoupServerMessage::wrote-body` signal handler if you need to wait for part or all of the response to be sent.

###### soup_server_message_unpause

Resumes I/O on `msg`.

since: 3.2

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Soup.ServerMessage:tls-peer-certificate

The peer’s `GTlsCertificate` associated with the message.

since: 3.2

###### Soup.ServerMessage:tls-peer-certificate-errors

The verification errors on `SoupServerMessage:tls-peer-certificate`.

since: 3.2

#### Signals

###### Soup.ServerMessage::accept-certificate

Emitted during the `msg`‘s connection TLS handshake after client TLS certificate has been received. You can return `TRUE` to accept `tls_certificate` despite `tls_errors`.

###### Soup.ServerMessage::connected

Emitted when the `msg`‘s socket is connected and the TLS handshake completed.

###### Soup.ServerMessage::disconnected

Emitted when the `msg`‘s socket is disconnected.

###### Soup.ServerMessage::finished

Emitted when all HTTP processing is finished for a message. (After `SoupServerMessage::wrote-body`).

###### Soup.ServerMessage::got-body

Emitted after receiving the complete request body.

###### Soup.ServerMessage::got-chunk

Emitted after receiving a chunk of a message body.

###### Soup.ServerMessage::got-headers

Emitted after receiving the Request-Line and request headers.

###### Soup.ServerMessage::wrote-body

Emitted immediately after writing the complete response body for a message.

###### Soup.ServerMessage::wrote-body-data

Emitted immediately after writing a portion of the message body to the network.

###### Soup.ServerMessage::wrote-chunk

Emitted immediately after writing a body chunk for a message.

###### Soup.ServerMessage::wrote-headers

Emitted immediately after writing the response headers for a message.

###### Soup.ServerMessage::wrote-informational

Emitted immediately after writing a 1xx (Informational) response.

##### 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.

#### Class structure

    struct SoupServerMessageClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`
  No description available.