soup.server_message

Module for [ServerMessage] class

Types 3

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 [soup.server_message.ServerMessage]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.

Methods
GType _gType() @property
ServerMessage self()Returns `this`, for use in `with` statements.
ServerMessageGidBuilder builder()Get builder for [soup.server_message.ServerMessage] Returns: New builder object
gio.tls_certificate.TlsCertificate tlsPeerCertificate() @propertyGet `tlsPeerCertificate` property. Returns: The peer's #GTlsCertificate associated with the message
gio.types.TlsCertificateFlags tlsPeerCertificateErrors() @propertyGet `tlsPeerCertificateErrors` property. Returns: The verification errors on #SoupServerMessage:tls-peer-certificate
soup.types.HTTPVersion getHttpVersion()Get the HTTP version of msg. Returns: a #SoupHTTPVersion.
gio.socket_address.SocketAddress getLocalAddress()Retrieves the [gio.socket_address.SocketAddress] associated with the local end of a connection. Returns: the #GSocketAddress associated with the local end of a connection, it may be null if you use...
string getMethod()Get the HTTP method of msg. Returns: the HTTP method.
string getReasonPhrase()Get the HTTP reason phrase of msg. Returns: the reason phrase.
gio.socket_address.SocketAddress getRemoteAddress()Retrieves the [gio.socketaddress.SocketAddress] associated with the remote end of a connection. Returns: the #GSocketAddress associated with the remote end of a connection, it may be null if you us...
string getRemoteHost()Retrieves the IP address associated with the remote end of a connection. Returns: the IP address associated with the remote end of a connection, it may be null if you used [soup.server.Server.accep...
soup.message_body.MessageBody getRequestBody()Get the request body of msg. Returns: a #SoupMessageBody.
soup.message_headers.MessageHeaders getRequestHeaders()Get the request headers of msg. Returns: a #SoupMessageHeaders with the request headers.
soup.message_body.MessageBody getResponseBody()Get the response body of msg. Returns: a #SoupMessageBody.
soup.message_headers.MessageHeaders getResponseHeaders()Get the response headers of msg. Returns: a #SoupMessageHeaders with the response headers.
gio.socket.Socket getSocket()Retrieves the [gio.socket.Socket] that msg is associated with.
uint getStatus()Get the HTTP status code of msg. Returns: the HTTP status code.
gio.tls_certificate.TlsCertificate getTlsPeerCertificate()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. Returns: msg's TLS peer certifi...
gio.types.TlsCertificateFlags getTlsPeerCertificateErrors()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. Returns: a #GTlsCertificate...
glib.uri.Uri getUri()Get msg's URI. Returns: a #GUri
bool isOptionsPing()Gets if msg represents an OPTIONS message with the path `*`. Returns: true if is an OPTIONS ping
void pause()Pauses I/O on msg.
void setHttpVersion(soup.types.HTTPVersion version_)Set the HTTP version of msg.
void setRedirect(uint statusCode, string redirectUri)Sets msg's statuscode to statuscode and adds a Location header pointing to redirect_uri. Use this from a `classServer` when you want to redirect the client to another URI.
void setResponse(string contentType, soup.types.MemoryUse respUse, ubyte[] respBody = null)Convenience function to set the response body of a #SoupServerMessage. If content_type is null, the response body must be empty as well.
void setStatus(uint statusCode, string reasonPhrase = null)Sets msg's status code to status_code.
gio.iostream.IOStream stealConnection()"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...
void unpause()Resumes I/O on msg.
gulong connectAcceptCertificate(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == bool) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.tls_certificate.TlsCertificate))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == gio.types.TlsCertificateFlags))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : soup.server_message.ServerMessage))) && Parameters!T.length < 4)Connect to `AcceptCertificate` signal.
gulong connectConnected(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `Connected` signal.
gulong connectDisconnected(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `Disconnected` signal.
gulong connectFinished(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `Finished` signal.
gulong connectGotBody(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `GotBody` signal.
gulong connectGotChunk(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == glib.bytes.Bytes))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : soup.server_message.ServerMessage))) && Parameters!T.length < 3)Connect to `GotChunk` signal.
gulong connectGotHeaders(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `GotHeaders` signal.
gulong connectWroteBody(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `WroteBody` signal.
gulong connectWroteBodyData(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == uint))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : soup.server_message.ServerMessage))) && Parameters!T.length < 3)Connect to `WroteBodyData` signal.
gulong connectWroteChunk(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `WroteChunk` signal.
gulong connectWroteHeaders(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `WroteHeaders` signal.
gulong connectWroteInformational(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.server_message.ServerMessage))) && Parameters!T.length < 2)Connect to `WroteInformational` signal.
Constructors
this(void * ptr, Flag!"Take" take)

Fluent builder for [soup.server_message.ServerMessage]