ServerMessage

class ServerMessage(pointer: <Error class: unknown class><<Error class: unknown class>>)

An HTTP server request and response pair.

A SoupServerMessage represents an HTTP message that is being sent or received on a class@Server.

class@Server will create SoupServerMessages 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.

Skipped during bindings generation

  • parameter resp_body: Array parameter of type guint8 is not supported

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val soupServerMessagePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val tlsPeerCertificate: <Error class: unknown class>?

The peer's #GTlsCertificate associated with the message

Link copied to clipboard
val tlsPeerCertificateErrors: <Error class: unknown class>

The verification errors on #SoupServerMessage:tls-peer-certificate

Functions

Link copied to clipboard
fun connectAcceptCertificate(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>, <Error class: unknown class>) -> Boolean): <Error class: unknown class>

Emitted during the @msg's connection TLS handshake after client TLS certificate has been received. You can return true to accept @tls_certificate despite

Link copied to clipboard
fun connectConnected(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the @msg's socket is connected and the TLS handshake completed.

Link copied to clipboard
fun connectDisconnected(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the @msg's socket is disconnected.

Link copied to clipboard
fun connectFinished(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when all HTTP processing is finished for a message. (After signal@ServerMessage::wrote-body).

Link copied to clipboard
fun connectGotBody(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted after receiving the complete request body.

Link copied to clipboard
fun connectGotChunk(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

Emitted after receiving a chunk of a message body.

Link copied to clipboard
fun connectGotHeaders(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted after receiving the Request-Line and request headers.

Link copied to clipboard
fun connectWroteBody(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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

Link copied to clipboard
fun connectWroteBodyData(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

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

Link copied to clipboard
fun connectWroteChunk(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted immediately after writing a body chunk for a message.

Link copied to clipboard
fun connectWroteHeaders(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted immediately after writing the response headers for a message.

Link copied to clipboard
fun connectWroteInformational(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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

Link copied to clipboard

Get the HTTP version of @msg.

Link copied to clipboard
fun getLocalAddress(): <Error class: unknown class>?

Retrieves the class@Gio.SocketAddress associated with the local end of a connection.

Link copied to clipboard

Get the HTTP method of @msg.

Link copied to clipboard

Get the HTTP reason phrase of @msg.

Link copied to clipboard
fun getRemoteAddress(): <Error class: unknown class>?

Retrieves the class@Gio.SocketAddress associated with the remote end of a connection.

Link copied to clipboard

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

Link copied to clipboard

Get the request body of @msg.

Link copied to clipboard

Get the request headers of @msg.

Link copied to clipboard

Get the response body of @msg.

Link copied to clipboard

Get the response headers of @msg.

Link copied to clipboard
fun getSocket(): <Error class: unknown class>?

Retrieves the class@Gio.Socket that @msg is associated with.

Link copied to clipboard
fun getStatus(): <Error class: unknown class>

Get the HTTP status code of @msg.

Link copied to clipboard
fun getUri(): <Error class: unknown class>

Get @msg's URI.

Link copied to clipboard

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

Link copied to clipboard
fun pause()

Pauses I/O on @msg.

Link copied to clipboard

Set the HTTP version of @msg.

Link copied to clipboard
fun setRedirect(statusCode: <Error class: unknown class>, redirectUri: String)

Sets @msg's status_code to @status_code and adds a Location header pointing to @redirect_uri. Use this from a class@Server when you want to redirect the client to another URI.

Link copied to clipboard
fun setStatus(statusCode: <Error class: unknown class>, reasonPhrase: String? = null)

Sets @msg's status code to @status_code.

Link copied to clipboard
fun stealConnection(): <Error class: unknown class>

"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 signal@ServerMessage::wrote-informational or signal@ServerMessage::wrote-body signal handler if you need to wait for part or all of the response to be sent.

Link copied to clipboard
fun unpause()

Resumes I/O on @msg.