Message

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.Message.new_ or soup.message.Message.newFromUri, set up its fields appropriately, and send it.

property@Message:status-code will normally be a enum@Status value, eg, soup.types.Status.Ok, though of course it might actually be an unknown status code. property@Message: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 property@Message:reason-phrase in user-visible messages. Rather, you should look at property@Message: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.

class Message : ObjectG {}

Constructors

this
this(string method, string uriString)

Creates a new empty #SoupMessage, which will connect to uri.

Members

Functions

addFlags
void addFlags(soup.types.MessageFlags flags)

Adds flags to the set of msg's flags.

connectAcceptCertificate
ulong connectAcceptCertificate(T callback, Flag!"After" after)

Connect to AcceptCertificate signal.

connectAuthenticate
ulong connectAuthenticate(T callback, Flag!"After" after)

Connect to Authenticate signal.

connectFinished
ulong connectFinished(T callback, Flag!"After" after)

Connect to Finished signal.

connectGotBody
ulong connectGotBody(T callback, Flag!"After" after)

Connect to GotBody signal.

connectGotBodyData
ulong connectGotBodyData(T callback, Flag!"After" after)

Connect to GotBodyData signal.

connectGotHeaders
ulong connectGotHeaders(T callback, Flag!"After" after)

Connect to GotHeaders signal.

connectGotInformational
ulong connectGotInformational(T callback, Flag!"After" after)

Connect to GotInformational signal.

connectHstsEnforced
ulong connectHstsEnforced(T callback, Flag!"After" after)

Connect to HstsEnforced signal.

connectNetworkEvent
ulong connectNetworkEvent(T callback, Flag!"After" after)

Connect to NetworkEvent signal.

connectRequestCertificate
ulong connectRequestCertificate(T callback, Flag!"After" after)

Connect to RequestCertificate signal.

connectRequestCertificatePassword
ulong connectRequestCertificatePassword(T callback, Flag!"After" after)

Connect to RequestCertificatePassword signal.

connectRestarted
ulong connectRestarted(T callback, Flag!"After" after)

Connect to Restarted signal.

connectStarting
ulong connectStarting(T callback, Flag!"After" after)

Connect to Starting signal.

connectWroteBody
ulong connectWroteBody(T callback, Flag!"After" after)

Connect to WroteBody signal.

connectWroteBodyData
ulong connectWroteBodyData(T callback, Flag!"After" after)

Connect to WroteBodyData signal.

connectWroteHeaders
ulong connectWroteHeaders(T callback, Flag!"After" after)

Connect to WroteHeaders signal.

disableFeature
void disableFeature(gobject.types.GType featureType)

Disables the actions of ifaceSessionFeatures with the given feature_type (or a subclass of that type) on msg.

getConnectionId
ulong getConnectionId()

Returns the unique idenfier for the last connection used.

getFirstParty
glib.uri.Uri getFirstParty()

Gets msg's first-party glib.uri.Uri.

getFlags
soup.types.MessageFlags getFlags()

Gets the flags on msg.

getForceHttp1
bool getForceHttp1()

Returns whether HTTP/1 version is currently demanded for the msg send.

getHttpVersion
soup.types.HTTPVersion getHttpVersion()

Gets the HTTP version of msg.

getIsOptionsPing
bool getIsOptionsPing()

Gets whether msg is intended to be used to send OPTIONS * to a server.

getIsTopLevelNavigation
bool getIsTopLevelNavigation()

Returns if this message is set as a top level navigation.

getMethod
string getMethod()

Returns the method of this message.

getMetrics
soup.message_metrics.MessageMetrics getMetrics()

Get the structMessageMetrics of msg.

getPriority
soup.types.MessagePriority getPriority()

Retrieves the enumMessagePriority.

getReasonPhrase
string getReasonPhrase()

Returns the reason phrase for the status of this message.

getRemoteAddress
gio.socket_address.SocketAddress getRemoteAddress()

Get the remote gio.socket_address.SocketAddress of the connection associated with the message.

getRequestHeaders
soup.message_headers.MessageHeaders getRequestHeaders()

Returns the headers sent with the request.

getResponseHeaders
soup.message_headers.MessageHeaders getResponseHeaders()

Returns the headers recieved with the response.

getSiteForCookies
glib.uri.Uri getSiteForCookies()

Gets msg's site for cookies #GUri.

getStatus
soup.types.Status getStatus()

Returns the set status of this message.

getTlsCiphersuiteName
string getTlsCiphersuiteName()

Gets the name of the TLS ciphersuite negotiated for msg's connection.

getTlsPeerCertificate
gio.tls_certificate.TlsCertificate getTlsPeerCertificate()

Gets the peer's gio.tls_certificate.TlsCertificate associated with msg's connection.

getTlsPeerCertificateErrors
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 signalMessage::accept-certificate signal.

getTlsProtocolVersion
gio.types.TlsProtocolVersion getTlsProtocolVersion()

Gets the TLS protocol version negotiated for msg's connection.

getUri
glib.uri.Uri getUri()

Gets msg's URI.

isFeatureDisabled
bool isFeatureDisabled(gobject.types.GType featureType)

Get whether ifaceSessionFeatures of the given feature_type (or a subclass of that type) are disabled on msg.

isKeepalive
bool isKeepalive()

Determines whether or not msg's connection can be kept alive for further requests after processing msg.

queryFlags
bool queryFlags(soup.types.MessageFlags flags)

Queries if flags are present in the set of msg's flags.

removeFlags
void removeFlags(soup.types.MessageFlags flags)

Removes flags from the set of msg's flags.

setFirstParty
void setFirstParty(glib.uri.Uri firstParty)

Sets first_party as the main document #GUri for msg.

setFlags
void setFlags(soup.types.MessageFlags flags)

Sets the specified flags on msg.

setForceHttp1
void setForceHttp1(bool value)

Sets whether HTTP/1 version should be used when sending this message. Some connections can still override it, if needed.

setIsOptionsPing
void setIsOptionsPing(bool isOptionsPing)

Set whether msg is intended to be used to send OPTIONS * to a server.

setIsTopLevelNavigation
void setIsTopLevelNavigation(bool isTopLevelNavigation)

Sets whether the current request is a top-level navitation.

setMethod
void setMethod(string method)

Set msg's HTTP method to method.

setPriority
void setPriority(soup.types.MessagePriority priority)

Sets the priority of a message.

setRequestBody
void setRequestBody(string contentType, gio.input_stream.InputStream stream, ptrdiff_t contentLength)

Set the request body of a #SoupMessage.

setRequestBodyFromBytes
void setRequestBodyFromBytes(string contentType, glib.bytes.Bytes bytes)

Set the request body of a #SoupMessage from glib.bytes.Bytes.

setSiteForCookies
void setSiteForCookies(glib.uri.Uri siteForCookies)

Sets site_for_cookies as the policy URL for same-site cookies for msg.

setTlsClientCertificate
void setTlsClientCertificate(gio.tls_certificate.TlsCertificate certificate)

Sets the certificate to be used by msg's connection when a client certificate is requested during the TLS handshake.

setUri
void setUri(glib.uri.Uri uri)

Sets msg's URI to uri.

tlsClientCertificatePasswordRequestComplete
void tlsClientCertificatePasswordRequestComplete()

Completes a certificate password request.

Static functions

newFromEncodedForm
soup.message.Message newFromEncodedForm(string method, string uriString, string encodedForm)

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.

newFromMultipart
soup.message.Message newFromMultipart(string uriString, soup.multipart.Multipart multipart)

Creates a new #SoupMessage and sets it up to send multipart to uri_string via POST.

newFromUri
soup.message.Message newFromUri(string method, glib.uri.Uri uri)

Creates a new empty #SoupMessage, which will connect to uri.

newOptionsPing
soup.message.Message newOptionsPing(glib.uri.Uri baseUri)

Creates a new #SoupMessage to send OPTIONS * to a server. The path of base_uri will be ignored.

Inherited Members

From ObjectG

setGObject
void setGObject(void* cObj, Flag!"Take" take)

Set the GObject of a D ObjectG wrapper.

cPtr
void* cPtr(Flag!"Dup" dup)

Get a pointer to the underlying C object.

ref_
void* ref_(void* gObj)

Calls g_object_ref() on a GObject.

unref
unref(void* gObj)

Calls g_object_unref() on a GObject.

getType
GType getType()

Get the GType of an object.

gType
GType gType [@property getter]

GObject GType property.

self
ObjectG self()

Convenience method to return this cast to a type. For use in D with statements.

getDObject
T getDObject(void* cptr, Flag!"Take" take)

Template to get the D object from a C GObject and cast it to the given D object type.

connectSignalClosure
ulong connectSignalClosure(string signalDetail, DClosure closure, Flag!"After" after)

Connect a D closure to an object signal.

setProperty
void setProperty(string propertyName, T val)

Template for setting a GObject property.

getProperty
T getProperty(string propertyName)

Template for getting a GObject property.

compatControl
size_t compatControl(size_t what, void* data)
bindProperty
gobject.binding.Binding bindProperty(string sourceProperty, gobject.object.ObjectG target, string targetProperty, gobject.types.BindingFlags flags)

Creates a binding between source_property on source and target_property on target.

bindPropertyFull
gobject.binding.Binding bindPropertyFull(string sourceProperty, gobject.object.ObjectG target, string targetProperty, gobject.types.BindingFlags flags, gobject.closure.Closure transformTo, gobject.closure.Closure transformFrom)

Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

forceFloating
void forceFloating()

This function is intended for #GObject implementations to re-enforce a floating[floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling gobject.object.ObjectG.refSink.

freezeNotify
void freezeNotify()

Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

getData
void* getData(string key)

Gets a named field from the objects table of associations (see gobject.object.ObjectG.setData).

getProperty
void getProperty(string propertyName, gobject.value.Value value)

Gets a property of an object.

getQdata
void* getQdata(glib.types.Quark quark)

This function gets back user data pointers stored via gobject.object.ObjectG.setQdata.

getv
void getv(string[] names, gobject.value.Value[] values)

Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

isFloating
bool isFloating()

Checks whether object has a floating[floating-ref] reference.

notify
void notify(string propertyName)

Emits a "notify" signal for the property property_name on object.

notifyByPspec
void notifyByPspec(gobject.param_spec.ParamSpec pspec)

Emits a "notify" signal for the property specified by pspec on object.

refSink
gobject.object.ObjectG refSink()

Increase the reference count of object, and possibly remove the floating[floating-ref] reference, if object has a floating reference.

runDispose
void runDispose()

Releases all references to other objects. This can be used to break reference cycles.

setData
void setData(string key, void* data)

Each object carries around a table of associations from strings to pointers. This function lets you set an association.

setProperty
void setProperty(string propertyName, gobject.value.Value value)

Sets a property on an object.

stealData
void* stealData(string key)

Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

stealQdata
void* stealQdata(glib.types.Quark quark)

This function gets back user data pointers stored via gobject.object.ObjectG.setQdata and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

thawNotify
void thawNotify()

Reverts the effect of a previous call to gobject.object.ObjectG.freezeNotify. The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

watchClosure
void watchClosure(gobject.closure.Closure closure)

This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling gobject.closure.Closure.invalidate on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, gobject.object.ObjectG.ref_ and gobject.object.ObjectG.unref are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

connectNotify
ulong connectNotify(string detail, T callback, Flag!"After" after)

Connect to Notify signal.