gi-soup-3.0.2: Libsoup bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Soup.Objects.Message

Description

Represents an HTTP message being sent or received.

A Message represents an HTTP message that is being sent or received.

You would create a Message with [ctormessage.new] or [ctormessage.new_from_uri], set up its fields appropriately, and send it.

propertymessage:status-code
will normally be a [enumstatus] value, eg, StatusOk, though of course it might actually be an unknown status code. [propertymessage:reason-phrase] is the actual text returned from the server, which may or may not correspond to the "standard" description of statusCode. 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
propertymessage:reason-phrase
in user-visible messages. Rather, you should look at [propertymessage: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 Message combines both the request and the response.

Synopsis

Exported types

newtype Message Source #

Memory-managed wrapper type.

Constructors

Message (ManagedPtr Message) 

Instances

Instances details
Eq Message Source # 
Instance details

Defined in GI.Soup.Objects.Message

Methods

(==) :: Message -> Message -> Bool #

(/=) :: Message -> Message -> Bool #

GObject Message Source # 
Instance details

Defined in GI.Soup.Objects.Message

ManagedPtrNewtype Message Source # 
Instance details

Defined in GI.Soup.Objects.Message

Methods

toManagedPtr :: Message -> ManagedPtr Message

TypedObject Message Source # 
Instance details

Defined in GI.Soup.Objects.Message

Methods

glibType :: IO GType

HasParentTypes Message Source # 
Instance details

Defined in GI.Soup.Objects.Message

IsGValue (Maybe Message) Source #

Convert Message to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Soup.Objects.Message

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Message -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Message)

type ParentTypes Message Source # 
Instance details

Defined in GI.Soup.Objects.Message

type ParentTypes Message = '[Object]

class (GObject o, IsDescendantOf Message o) => IsMessage o Source #

Type class for types which can be safely cast to Message, for instance with toMessage.

Instances

Instances details
(GObject o, IsDescendantOf Message o) => IsMessage o Source # 
Instance details

Defined in GI.Soup.Objects.Message

toMessage :: (MonadIO m, IsMessage o) => o -> m Message Source #

Cast to Message, for types for which this is known to be safe. For general casts, use castTo.

Methods

addFlags

messageAddFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> [MessageFlags]

flags: a set of MessageFlags values

-> m () 

Adds flags to the set of msg's flags.

disableFeature

messageDisableFeature Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> GType

featureType: the GType of a SessionFeature

-> m () 

Disables the actions of [ifacesessionFeature]s with the given featureType (or a subclass of that type) on msg.

msg is processed as though the feature(s) hadn't been added to the session. Eg, passing SOUP_TYPE_CONTENT_SNIFFER for featureType will disable Content-Type sniffing on the message.

You must call this before queueing msg on a session; calling it on a message that has already been queued is undefined. In particular, you cannot call this on a message that is being requeued after a redirect or authentication.

getConnectionId

messageGetConnectionId Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m Word64

Returns: An id or 0 if no connection.

Returns the unique idenfier for the last connection used.

This may be 0 if it was a cached resource or it has not gotten a connection yet.

getFirstParty

messageGetFirstParty Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m Uri

Returns: the msg's first party Uri

Gets msg's first-party [structgLib.Uri].

getFlags

messageGetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m [MessageFlags]

Returns: the flags

Gets the flags on msg.

getForceHttp1

messageGetForceHttp1 Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m Bool

Returns: True, when HTTP/1 is demanded, False otherwise.

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

Since: 3.4

getHttpVersion

messageGetHttpVersion Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m HTTPVersion

Returns: the HTTP version

Gets the HTTP version of msg.

This is the minimum of the version from the request and the version from the response.

getIsOptionsPing

messageGetIsOptionsPing Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m Bool

Returns: True if the message is options ping, or False otherwise

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

getIsTopLevelNavigation

messageGetIsTopLevelNavigation Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m Bool

Returns: Whether the current request is a top-level navitation

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

Used for same-site policy checks.

getMethod

messageGetMethod Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m Text

Returns: A method such as SOUP_METHOD_GET

Returns the method of this message.

getMetrics

messageGetMetrics Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m (Maybe MessageMetrics)

Returns: a MessageMetrics

Get the [structmessageMetrics] of msg.

If the flag MessageFlagsCollectMetrics is not enabled for msg this will return Nothing.

getPriority

messageGetPriority Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m MessagePriority

Returns: the priority of the message.

Retrieves the [enummessagePriority].

If not set this value defaults to SOUP_MESSAGE_PRIORITY_NORMAL.

getReasonPhrase

messageGetReasonPhrase Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m (Maybe Text)

Returns: the phrase

Returns the reason phrase for the status of this message.

getRemoteAddress

messageGetRemoteAddress Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m (Maybe SocketAddress)

Returns: a SocketAddress or Nothing if the connection hasn't been established

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

The returned address can be Nothing if the connection hasn't been established yet, or the resource was loaded from the disk cache. In case of proxy connections, the remote address returned is a ProxyAddress. If [propertysession:remote-connectable] is set the returned address id for the connection to the session's remote connectable.

getRequestHeaders

messageGetRequestHeaders Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m MessageHeaders

Returns: The MessageHeaders

Returns the headers sent with the request.

getResponseHeaders

messageGetResponseHeaders Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m MessageHeaders

Returns: The MessageHeaders

Returns the headers recieved with the response.

getSiteForCookies

messageGetSiteForCookies Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m Uri

Returns: the msg's site for cookies Uri

Gets msg's site for cookies Uri.

getStatus

messageGetStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> m Status

Returns: The Status

Returns the set status of this message.

getTlsCiphersuiteName

messageGetTlsCiphersuiteName Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m Text

Returns: the name of the TLS ciphersuite, or Nothing if msg's connection is not SSL.

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

getTlsPeerCertificate

messageGetTlsPeerCertificate Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m (Maybe TlsCertificate)

Returns: msg's TLS peer certificate, or Nothing if msg's connection is not SSL.

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

Note that this is not set yet during the emission of signalmessage[acceptCertificate] signal.

getTlsPeerCertificateErrors

messageGetTlsPeerCertificateErrors Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m [TlsCertificateFlags]

Returns: a TlsCertificateFlags with msg's 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 signalmessage[acceptCertificate] signal.

getTlsProtocolVersion

messageGetTlsProtocolVersion Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m TlsProtocolVersion

Returns: a TlsProtocolVersion

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

If the message connection is not SSL, TlsProtocolVersionUnknown is returned.

getUri

messageGetUri Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m Uri

Returns: the URI msg is targeted for.

Gets msg's URI.

isFeatureDisabled

messageIsFeatureDisabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> GType

featureType: the GType of a SessionFeature

-> m Bool

Returns: True if feature is disabled, or False otherwise.

Get whether [ifacesessionFeature]s of the given featureType (or a subclass of that type) are disabled on msg.

See [methodmessage.disable_feature].

isKeepalive

messageIsKeepalive Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m Bool

Returns: True or False.

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

The result is based on the HTTP version, Connection header, etc.

new

messageNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

method: the HTTP method for the created request

-> Text

uriString: the destination endpoint (as a string)

-> m (Maybe Message)

Returns: the new Message (or Nothing if uri could not be parsed).

Creates a new empty Message, which will connect to uri.

newFromEncodedForm

messageNewFromEncodedForm Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

method: the HTTP method for the created request (GET, POST or PUT)

-> Text

uriString: the destination endpoint (as a string)

-> Text

encodedForm: a encoded form

-> m (Maybe Message)

Returns: the new Message, or Nothing if uriString could not be parsed or method is not "GET, "POST" or "PUT"

Creates a new Message and sets it up to send the given encodedForm 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.

This function takes the ownership of encodedForm, that will be released with free when no longer in use. See also [funcformEncode], [funcformEncodeHash] and [funcformEncodeDatalist].

newFromMultipart

messageNewFromMultipart Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

uriString: the destination endpoint

-> Multipart

multipart: a Multipart

-> m (Maybe Message)

Returns: the new Message, or Nothing if uriString could not be parsed

Creates a new Message and sets it up to send multipart to uriString via POST.

newFromUri

messageNewFromUri Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

method: the HTTP method for the created request

-> Uri

uri: the destination endpoint

-> m Message

Returns: the new Message

Creates a new empty Message, which will connect to uri.

newOptionsPing

messageNewOptionsPing Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Uri

baseUri: the destination endpoint

-> m Message

Returns: the new Message

Creates a new Message to send OPTIONS * to a server. The path of baseUri will be ignored.

queryFlags

messageQueryFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> [MessageFlags]

flags: a set of MessageFlags values

-> m Bool

Returns: True if flags are enabled in msg

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

removeFlags

messageRemoveFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> [MessageFlags]

flags: a set of MessageFlags values

-> m () 

Removes flags from the set of msg's flags.

setFirstParty

messageSetFirstParty Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> Uri

firstParty: the Uri for the msg's first party

-> m () 

Sets firstParty as the main document Uri for msg.

For details of when and how this is used refer to the documentation for [enumcookieJarAcceptPolicy].

setFlags

messageSetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> [MessageFlags]

flags: a set of MessageFlags values

-> m () 

Sets the specified flags on msg.

setForceHttp1

messageSetForceHttp1 Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: The Message

-> Bool

value: value to set

-> m () 

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

Note the value is unset after the message send is finished.

Since: 3.4

setIsOptionsPing

messageSetIsOptionsPing Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> Bool

isOptionsPing: the value to set

-> m () 

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

When set to True, the path of [propertymessage:uri] will be ignored and [propertymessage:method] set to SOUP_METHOD_OPTIONS.

setIsTopLevelNavigation

messageSetIsTopLevelNavigation Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> Bool

isTopLevelNavigation: if True indicate the current request is a top-level navigation

-> m () 

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

See the same-site spec for more information.

setMethod

messageSetMethod Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> Text

method: the value to set

-> m () 

Set msg's HTTP method to method.

setPriority

messageSetPriority Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> MessagePriority

priority: the MessagePriority

-> m () 

Sets the priority of a message.

Note that this won't have any effect unless used before the message is added to the session's message processing queue.

The message will be placed just before any other previously added message with lower priority (messages with the same priority are processed on a FIFO basis).

Setting priorities does not currently work with synchronous messages because in the synchronous/blocking case, priority ends up being determined semi-randomly by thread scheduling.

setRequestBody

messageSetRequestBody Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a, IsInputStream b) 
=> a

msg: the message

-> Maybe Text

contentType: MIME Content-Type of the body, or Nothing if unknown

-> Maybe b

stream: a InputStream to read the request body from

-> Int64

contentLength: the byte length of stream or -1 if unknown

-> m () 

Set the request body of a Message.

If contentType is Nothing and stream is not Nothing the Content-Type header will not be changed if present. The request body needs to be set again in case msg is restarted (in case of redirection or authentication).

setRequestBodyFromBytes

messageSetRequestBodyFromBytes Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: the message

-> Maybe Text

contentType: MIME Content-Type of the body, or Nothing if unknown

-> Maybe Bytes

bytes: a Bytes with the request body data

-> m () 

Set the request body of a Message from [structgLib.Bytes].

If contentType is Nothing and bytes is not Nothing the Content-Type header will not be changed if present. The request body needs to be set again in case msg is restarted (in case of redirection or authentication).

setSiteForCookies

messageSetSiteForCookies Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> Maybe Uri

siteForCookies: the Uri for the msg's site for cookies

-> m () 

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

It is either the URL of the top-level document or Nothing depending on whether the registrable domain of this document's URL matches the registrable domain of its parent's/opener's URL. For the top-level document it is set to the document's URL.

See the same-site spec for more information.

setTlsClientCertificate

messageSetTlsClientCertificate Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a, IsTlsCertificate b) 
=> a

msg: a Message

-> Maybe b

certificate: the TlsCertificate to set, or Nothing

-> m () 

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

You can call this as a response to signalmessage[requestCertificate] signal, or before the connection is started. If certificate is Nothing the handshake will continue without providing a GTlsCertificate. Note that the TlsCertificate set by this function will be ignored if [propertysession:tls-interaction] is not Nothing.

setUri

messageSetUri Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> Uri

uri: the new Uri

-> m () 

Sets msg's URI to uri.

If msg has already been sent and you want to re-send it with the new URI, you need to send it again.

tlsClientCertificatePasswordRequestComplete

messageTlsClientCertificatePasswordRequestComplete Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> a

msg: a Message

-> m () 

Completes a certificate password request.

You must call this as a response to signalmessage[requestCertificatePassword] signal, to notify msg that the TlsPassword has already been updated.

Properties

firstParty

The [structgLib.Uri] loaded in the application when the message was queued.

constructMessageFirstParty :: (IsMessage o, MonadIO m) => Uri -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “first-party” property. This is rarely needed directly, but it is used by new.

getMessageFirstParty :: (MonadIO m, IsMessage o) => o -> m Uri Source #

Get the value of the “first-party” property. When overloading is enabled, this is equivalent to

get message #firstParty

setMessageFirstParty :: (MonadIO m, IsMessage o) => o -> Uri -> m () Source #

Set the value of the “first-party” property. When overloading is enabled, this is equivalent to

set message [ #firstParty := value ]

flags

Various message options.

constructMessageFlags :: (IsMessage o, MonadIO m) => [MessageFlags] -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “flags” property. This is rarely needed directly, but it is used by new.

getMessageFlags :: (MonadIO m, IsMessage o) => o -> m [MessageFlags] Source #

Get the value of the “flags” property. When overloading is enabled, this is equivalent to

get message #flags

setMessageFlags :: (MonadIO m, IsMessage o) => o -> [MessageFlags] -> m () Source #

Set the value of the “flags” property. When overloading is enabled, this is equivalent to

set message [ #flags := value ]

httpVersion

The HTTP protocol version to use.

getMessageHttpVersion :: (MonadIO m, IsMessage o) => o -> m HTTPVersion Source #

Get the value of the “http-version” property. When overloading is enabled, this is equivalent to

get message #httpVersion

isOptionsPing

Whether the message is an OPTIONS ping.

The Message is intended to be used to send OPTIONS * to a server. When set to True, the path of [propertymessage:uri] will be ignored and [propertymessage:method] set to SOUP_METHOD_OPTIONS.

constructMessageIsOptionsPing :: (IsMessage o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “is-options-ping” property. This is rarely needed directly, but it is used by new.

getMessageIsOptionsPing :: (MonadIO m, IsMessage o) => o -> m Bool Source #

Get the value of the “is-options-ping” property. When overloading is enabled, this is equivalent to

get message #isOptionsPing

setMessageIsOptionsPing :: (MonadIO m, IsMessage o) => o -> Bool -> m () Source #

Set the value of the “is-options-ping” property. When overloading is enabled, this is equivalent to

set message [ #isOptionsPing := value ]

isTopLevelNavigation

Set when the message is navigating between top level domains.

constructMessageIsTopLevelNavigation :: (IsMessage o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “is-top-level-navigation” property. This is rarely needed directly, but it is used by new.

getMessageIsTopLevelNavigation :: (MonadIO m, IsMessage o) => o -> m Bool Source #

Get the value of the “is-top-level-navigation” property. When overloading is enabled, this is equivalent to

get message #isTopLevelNavigation

setMessageIsTopLevelNavigation :: (MonadIO m, IsMessage o) => o -> Bool -> m () Source #

Set the value of the “is-top-level-navigation” property. When overloading is enabled, this is equivalent to

set message [ #isTopLevelNavigation := value ]

method

The message's HTTP method.

constructMessageMethod :: (IsMessage o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “method” property. This is rarely needed directly, but it is used by new.

getMessageMethod :: (MonadIO m, IsMessage o) => o -> m Text Source #

Get the value of the “method” property. When overloading is enabled, this is equivalent to

get message #method

setMessageMethod :: (MonadIO m, IsMessage o) => o -> Text -> m () Source #

Set the value of the “method” property. When overloading is enabled, this is equivalent to

set message [ #method := value ]

priority

Sets the priority of the Message. See [methodmessage.set_priority] for further details.

constructMessagePriority :: (IsMessage o, MonadIO m) => MessagePriority -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “priority” property. This is rarely needed directly, but it is used by new.

getMessagePriority :: (MonadIO m, IsMessage o) => o -> m MessagePriority Source #

Get the value of the “priority” property. When overloading is enabled, this is equivalent to

get message #priority

setMessagePriority :: (MonadIO m, IsMessage o) => o -> MessagePriority -> m () Source #

Set the value of the “priority” property. When overloading is enabled, this is equivalent to

set message [ #priority := value ]

reasonPhrase

The HTTP response reason phrase.

getMessageReasonPhrase :: (MonadIO m, IsMessage o) => o -> m (Maybe Text) Source #

Get the value of the “reason-phrase” property. When overloading is enabled, this is equivalent to

get message #reasonPhrase

remoteAddress

The remote SocketAddress of the connection associated with the message.

getMessageRemoteAddress :: (MonadIO m, IsMessage o) => o -> m (Maybe SocketAddress) Source #

Get the value of the “remote-address” property. When overloading is enabled, this is equivalent to

get message #remoteAddress

requestHeaders

The HTTP request headers.

getMessageRequestHeaders :: (MonadIO m, IsMessage o) => o -> m MessageHeaders Source #

Get the value of the “request-headers” property. When overloading is enabled, this is equivalent to

get message #requestHeaders

responseHeaders

The HTTP response headers.

getMessageResponseHeaders :: (MonadIO m, IsMessage o) => o -> m MessageHeaders Source #

Get the value of the “response-headers” property. When overloading is enabled, this is equivalent to

get message #responseHeaders

siteForCookies

Site used to compare cookies against. Used for SameSite cookie support.

clearMessageSiteForCookies :: (MonadIO m, IsMessage o) => o -> m () Source #

Set the value of the “site-for-cookies” property to Nothing. When overloading is enabled, this is equivalent to

clear #siteForCookies

constructMessageSiteForCookies :: (IsMessage o, MonadIO m) => Uri -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “site-for-cookies” property. This is rarely needed directly, but it is used by new.

getMessageSiteForCookies :: (MonadIO m, IsMessage o) => o -> m Uri Source #

Get the value of the “site-for-cookies” property. When overloading is enabled, this is equivalent to

get message #siteForCookies

setMessageSiteForCookies :: (MonadIO m, IsMessage o) => o -> Uri -> m () Source #

Set the value of the “site-for-cookies” property. When overloading is enabled, this is equivalent to

set message [ #siteForCookies := value ]

statusCode

The HTTP response status code.

getMessageStatusCode :: (MonadIO m, IsMessage o) => o -> m Word32 Source #

Get the value of the “status-code” property. When overloading is enabled, this is equivalent to

get message #statusCode

tlsCiphersuiteName

The Name of TLS ciphersuite negotiated for this message connection.

getMessageTlsCiphersuiteName :: (MonadIO m, IsMessage o) => o -> m Text Source #

Get the value of the “tls-ciphersuite-name” property. When overloading is enabled, this is equivalent to

get message #tlsCiphersuiteName

tlsPeerCertificate

The peer's TlsCertificate associated with the message.

getMessageTlsPeerCertificate :: (MonadIO m, IsMessage o) => o -> m (Maybe TlsCertificate) Source #

Get the value of the “tls-peer-certificate” property. When overloading is enabled, this is equivalent to

get message #tlsPeerCertificate

tlsPeerCertificateErrors

The verification errors on [propertymessage:tls-peer-certificate].

getMessageTlsPeerCertificateErrors :: (MonadIO m, IsMessage o) => o -> m [TlsCertificateFlags] Source #

Get the value of the “tls-peer-certificate-errors” property. When overloading is enabled, this is equivalent to

get message #tlsPeerCertificateErrors

tlsProtocolVersion

The TLS protocol version negotiated for the message connection.

getMessageTlsProtocolVersion :: (MonadIO m, IsMessage o) => o -> m TlsProtocolVersion Source #

Get the value of the “tls-protocol-version” property. When overloading is enabled, this is equivalent to

get message #tlsProtocolVersion

uri

The message's Request-URI.

constructMessageUri :: (IsMessage o, MonadIO m) => Uri -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “uri” property. This is rarely needed directly, but it is used by new.

getMessageUri :: (MonadIO m, IsMessage o) => o -> m Uri Source #

Get the value of the “uri” property. When overloading is enabled, this is equivalent to

get message #uri

setMessageUri :: (MonadIO m, IsMessage o) => o -> Uri -> m () Source #

Set the value of the “uri” property. When overloading is enabled, this is equivalent to

set message [ #uri := value ]

Signals

acceptCertificate

type MessageAcceptCertificateCallback Source #

Arguments

 = TlsCertificate

tlsPeerCertificate: the peer's TlsCertificate

-> [TlsCertificateFlags]

tlsPeerErrors: the tls errors of tlsCertificate

-> IO Bool

Returns: True to accept the TLS certificate and stop other handlers from being invoked, or False to propagate the event further.

Emitted during the msg's connection TLS handshake after an unacceptable TLS certificate has been received.

You can return True to accept tlsCertificate despite tlsErrors.

afterMessageAcceptCertificate :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageAcceptCertificateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the acceptCertificate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #acceptCertificate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageAcceptCertificate :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageAcceptCertificateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the acceptCertificate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #acceptCertificate callback

authenticate

type MessageAuthenticateCallback Source #

Arguments

 = Auth

auth: the Auth to authenticate

-> Bool

retrying: True if this is the second (or later) attempt

-> IO Bool

Returns: True to stop other handlers from being invoked or False to propagate the event further.

Emitted when the message requires authentication.

If credentials are available call [methodauth.authenticate] on auth. If these credentials fail, the signal will be emitted again, with retrying set to True, which will continue until you return without calling [methodauth.authenticate] on auth.

Note that this may be emitted before msg's body has been fully read.

You can authenticate auth asynchronously by calling objectRef on auth and returning True. The operation will complete once either [methodauth.authenticate] or [methodauth.cancel] are called.

afterMessageAuthenticate :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageAuthenticateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the authenticate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #authenticate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageAuthenticate :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageAuthenticateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the authenticate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #authenticate callback

contentSniffed

type MessageContentSniffedCallback Source #

Arguments

 = Text

type: the content type that we got from sniffing

-> Map Text Text

params: a HashTable with the parameters

-> IO () 

This signal is emitted after signalmessage[gotHeaders].

If content sniffing is disabled, or no content sniffing will be performed, due to the sniffer deciding to trust the Content-Type sent by the server, this signal is emitted immediately after signalmessage[gotHeaders], and type is Nothing.

afterMessageContentSniffed :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageContentSniffedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the contentSniffed signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #contentSniffed callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageContentSniffed :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageContentSniffedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the contentSniffed signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #contentSniffed callback

finished

type MessageFinishedCallback = IO () Source #

Emitted when all HTTP processing is finished for a message.

(After signalmessage[got_body]).

afterMessageFinished :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageFinishedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the finished signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #finished callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageFinished :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageFinishedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the finished signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #finished callback

gotBody

type MessageGotBodyCallback = IO () Source #

Emitted after receiving the complete message response body.

afterMessageGotBody :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageGotBodyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the gotBody signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #gotBody callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageGotBody :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageGotBodyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the gotBody signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #gotBody callback

gotBodyData

type MessageGotBodyDataCallback Source #

Arguments

 = Word32

chunkSize: the number of bytes read

-> IO () 

Emitted after reading a portion of the message body from the network.

Since: 3.4

afterMessageGotBodyData :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageGotBodyDataCallback) -> m SignalHandlerId Source #

Connect a signal handler for the gotBodyData signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #gotBodyData callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageGotBodyData :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageGotBodyDataCallback) -> m SignalHandlerId Source #

Connect a signal handler for the gotBodyData signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #gotBodyData callback

gotHeaders

type MessageGotHeadersCallback = IO () Source #

Emitted after receiving the Status-Line and response headers.

See also [methodmessage.add_header_handler] and [methodmessage.add_status_code_handler], which can be used to connect to a subset of emissions of this signal.

If you cancel or requeue msg while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, and msg's connection will be closed. (If you need to requeue a message--eg, after handling authentication or redirection--it is usually better to requeue it from a signalmessage[gotBody] handler rather than a signalmessage[got_headers] handler, so that the existing HTTP connection can be reused.)

afterMessageGotHeaders :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageGotHeadersCallback) -> m SignalHandlerId Source #

Connect a signal handler for the gotHeaders signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #gotHeaders callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageGotHeaders :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageGotHeadersCallback) -> m SignalHandlerId Source #

Connect a signal handler for the gotHeaders signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #gotHeaders callback

gotInformational

type MessageGotInformationalCallback = IO () Source #

Emitted after receiving a 1xx (Informational) response for a (client-side) message.

The response_headers will be filled in with the headers associated with the informational response; however, those header values will be erased after this signal is done.

If you cancel or requeue msg while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, and msg's connection will be closed.

afterMessageGotInformational :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageGotInformationalCallback) -> m SignalHandlerId Source #

Connect a signal handler for the gotInformational signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #gotInformational callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageGotInformational :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageGotInformationalCallback) -> m SignalHandlerId Source #

Connect a signal handler for the gotInformational signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #gotInformational callback

hstsEnforced

type MessageHstsEnforcedCallback = IO () Source #

Emitted when [classhSTSEnforcer] has upgraded the protocol for msg to HTTPS as a result of matching its domain with a HSTS policy.

afterMessageHstsEnforced :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageHstsEnforcedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the hstsEnforced signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #hstsEnforced callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageHstsEnforced :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageHstsEnforcedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the hstsEnforced signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #hstsEnforced callback

networkEvent

type MessageNetworkEventCallback Source #

Arguments

 = SocketClientEvent

event: the network event

-> IOStream

connection: the current state of the network connection

-> IO () 

Emitted to indicate that some network-related event related to msg has occurred.

This essentially proxies the SocketClient::event signal, but only for events that occur while msg "owns" the connection; if msg is sent on an existing persistent connection, then this signal will not be emitted. (If you want to force the message to be sent on a new connection, set the MessageFlagsNewConnection flag on it.)

See SocketClient::event for more information on what the different values of event correspond to, and what connection will be in each case.

afterMessageNetworkEvent :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageNetworkEventCallback) -> m SignalHandlerId Source #

Connect a signal handler for the networkEvent signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #networkEvent callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageNetworkEvent :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageNetworkEventCallback) -> m SignalHandlerId Source #

Connect a signal handler for the networkEvent signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #networkEvent callback

requestCertificate

type MessageRequestCertificateCallback Source #

Arguments

 = TlsClientConnection

tlsConnection: the TlsClientConnection

-> IO Bool

Returns: True to handle the request, or False to make the connection fail with TlsErrorCertificateRequired.

Emitted during the msg's connection TLS handshake when tlsConnection requests a certificate from the client.

You can set the client certificate by calling [methodmessage.set_tls_client_certificate] and returning True. It's possible to handle the request asynchornously by returning True and call [methodmessage.set_tls_client_certificate] later once the certificate is available. Note that this signal is not emitted if [propertysession:tls-interaction] was set, or if [methodmessage.set_tls_client_certificate] was called before the connection TLS handshake started.

afterMessageRequestCertificate :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageRequestCertificateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the requestCertificate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #requestCertificate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageRequestCertificate :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageRequestCertificateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the requestCertificate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #requestCertificate callback

requestCertificatePassword

type MessageRequestCertificatePasswordCallback Source #

Arguments

 = TlsPassword

tlsPassword: the TlsPassword

-> IO Bool

Returns: True to handle the request, or False to make the connection fail with TlsErrorCertificateRequired.

Emitted during the msg's connection TLS handshake when tlsConnection requests a certificate password from the client.

You can set the certificate password on password, then call [methodmessage.tls_client_certificate_password_request_complete] and return True to handle the signal synchronously. It's possible to handle the request asynchornously by calling objectRef on password, then returning True and call [methodmessage.tls_client_certificate_password_request_complete] later after setting the password on password. Note that this signal is not emitted if [propertysession:tls-interaction] was set.

afterMessageRequestCertificatePassword :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageRequestCertificatePasswordCallback) -> m SignalHandlerId Source #

Connect a signal handler for the requestCertificatePassword signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #requestCertificatePassword callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageRequestCertificatePassword :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageRequestCertificatePasswordCallback) -> m SignalHandlerId Source #

Connect a signal handler for the requestCertificatePassword signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #requestCertificatePassword callback

restarted

type MessageRestartedCallback = IO () Source #

Emitted when a request that was already sent once is now being sent again.

e.g. because the first attempt received a redirection response, or because we needed to use authentication.

afterMessageRestarted :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageRestartedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the restarted signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #restarted callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageRestarted :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageRestartedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the restarted signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #restarted callback

starting

type MessageStartingCallback = IO () Source #

Emitted just before a message is sent.

afterMessageStarting :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageStartingCallback) -> m SignalHandlerId Source #

Connect a signal handler for the starting signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #starting callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageStarting :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageStartingCallback) -> m SignalHandlerId Source #

Connect a signal handler for the starting signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #starting callback

wroteBody

type MessageWroteBodyCallback = IO () Source #

Emitted immediately after writing the complete body for a message.

afterMessageWroteBody :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageWroteBodyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the wroteBody signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #wroteBody callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageWroteBody :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageWroteBodyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the wroteBody signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #wroteBody callback

wroteBodyData

type MessageWroteBodyDataCallback Source #

Arguments

 = Word32

chunkSize: the number of bytes written

-> IO () 

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

afterMessageWroteBodyData :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageWroteBodyDataCallback) -> m SignalHandlerId Source #

Connect a signal handler for the wroteBodyData signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #wroteBodyData callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageWroteBodyData :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageWroteBodyDataCallback) -> m SignalHandlerId Source #

Connect a signal handler for the wroteBodyData signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #wroteBodyData callback

wroteHeaders

type MessageWroteHeadersCallback = IO () Source #

Emitted immediately after writing the request headers for a message.

afterMessageWroteHeaders :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageWroteHeadersCallback) -> m SignalHandlerId Source #

Connect a signal handler for the wroteHeaders signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after message #wroteHeaders callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onMessageWroteHeaders :: (IsMessage a, MonadIO m) => a -> ((?self :: a) => MessageWroteHeadersCallback) -> m SignalHandlerId Source #

Connect a signal handler for the wroteHeaders signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on message #wroteHeaders callback