gi-soup-2.4.26: 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.

statusCode will normally be a Status value, eg, StatusOk, though of course it might actually be an unknown status code. reasonPhrase 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 reasonPhrase in user-visible messages. Rather, you should look at statusCode, and determine an end-user-appropriate message based on that and on what you were trying to do.

As described in the MessageBody documentation, the requestBody and responseBody <literal>data</literal> fields will not necessarily be filled in at all times. When the body fields are filled in, they will be terminated with a '\0' byte (which is not included in the <literal>length</literal>), so you can use them as ordinary C strings (assuming that you know that the body doesn't have any other '\0' bytes).

For a client-side Message, requestBody's <literal>data</literal> is usually filled in right before libsoup writes the request to the network, but you should not count on this; use messageBodyFlatten if you want to ensure that <literal>data</literal> is filled in. If you are not using Request to read the response, then responseBody's <literal>data</literal> will be filled in before Message::finished is emitted. (If you are using Request, then the message body is not accumulated by default, so responseBody's <literal>data</literal> will always be Nothing.)

For a server-side Message, requestBody's data will be filled in before Message::got_body is emitted.

To prevent the data field from being filled in at all (eg, if you are handling the data from a Message::got_chunk, and so don't need to see it all at the end), call messageBodySetAccumulate on responseBody or requestBody as appropriate, passing False.

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

contentSniffed

messageContentSniffed :: (HasCallStack, MonadIO m, IsMessage a) => a -> Text -> Map (Ptr ()) (Ptr ()) -> m () Source #

No description available in the introspection data.

disableFeature

messageDisableFeature Source #

Arguments

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

msg: a Message

-> GType

featureType: the GType of a SessionFeature

-> m () 

This disables the actions of SessionFeatures with the given featureType (or a subclass of that type) on msg, so that 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.

Since: 2.28

finished

messageFinished :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

getAddress

messageGetAddress Source #

Arguments

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

msg: a Message

-> m Address

Returns: the address msg's URI points to

Gets the address msg's URI points to. After first setting the URI on a message, this will be unresolved, although the message's session will resolve it before sending the message.

Since: 2.26

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 URI

Since: 2.30

getFlags

messageGetFlags Source #

Arguments

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

msg: a Message

-> m [MessageFlags]

Returns: the flags

Gets the flags on msg

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.

getHttpsStatus

messageGetHttpsStatus Source #

Arguments

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

msg: a Message

-> m (Bool, TlsCertificate, [TlsCertificateFlags])

Returns: True if msg used/attempted https, False if not

If msg is using https (or attempted to use https but got StatusSslFailed), this retrieves the TlsCertificate associated with its connection, and the TlsCertificateFlags showing what problems, if any, have been found with that certificate.

<note><para>This is only meaningful with messages processed by a Session and is not useful for messages received by a Server</para></note>

Since: 2.34

getIsTopLevelNavigation

messageGetIsTopLevelNavigation Source #

Arguments

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

msg: a Message

-> m Bool 

No description available in the introspection data.

Since: 2.70

getPriority

messageGetPriority Source #

Arguments

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

msg: a Message

-> m MessagePriority

Returns: the priority of the message.

Retrieves the MessagePriority. If not set this value defaults to SOUP_MESSAGE_PRIORITY_NORMAL.

Since: 2.44

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

Since: 2.70

getSoupRequest

messageGetSoupRequest Source #

Arguments

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

msg: a Message

-> m Request

Returns: msg's associated Request

If msg is associated with a Request, this returns that request. Otherwise it returns Nothing.

Since: 2.42

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

gotBody

messageGotBody :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

gotChunk

messageGotChunk :: (HasCallStack, MonadIO m, IsMessage a) => a -> Buffer -> m () Source #

No description available in the introspection data.

gotHeaders

messageGotHeaders :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

gotInformational

messageGotInformational :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

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 SessionFeatures of the given featureType (or a subclass of that type) are disabled on msg. See messageDisableFeature.

Since: 2.72

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, 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

newFromUri

messageNewFromUri Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

method: the HTTP method for the created request

-> URI

uri: the destination endpoint (as a URI)

-> m Message

Returns: the new Message

Creates a new empty Message, which will connect to uri

restarted

messageRestarted :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

setChunkAllocator

messageSetChunkAllocator Source #

Arguments

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

msg: a Message

-> ChunkAllocator

allocator: the chunk allocator callback

-> m () 

Deprecated: Request provides a much simpler API that lets youread the response directly into your own buffers without needing tomess with callbacks, pausing/unpausing, etc.

Sets an alternate chunk-allocation function to use when reading msg's body when using the traditional (ie, non-tRequest-based) API. Every time data is available to read, libsoup will call allocator, which should return a Buffer. (See ChunkAllocator for additional details.) Libsoup will then read data from the network into that buffer, and update the buffer's <literal>length</literal> to indicate how much data it read.

Generally, a custom chunk allocator would be used in conjunction with messageBodySetAccumulate False and Message::got_chunk, as part of a strategy to avoid unnecessary copying of data. However, you cannot assume that every call to the allocator will be followed by a call to your Message::got_chunk handler; if an I/O error occurs, then the buffer will be unreffed without ever having been used. If your buffer-allocation strategy requires special cleanup, use bufferNewWithOwner rather than doing the cleanup from the Message::got_chunk handler.

The other thing to remember when using non-accumulating message bodies is that the buffer passed to the Message::got_chunk handler will be unreffed after the handler returns, just as it would be in the non-custom-allocated case. If you want to hand the chunk data off to some other part of your program to use later, you'll need to ref the Buffer (or its owner, in the bufferNewWithOwner case) to ensure that the data remains valid.

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

Since: 2.30

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.

setHttpVersion

messageSetHttpVersion Source #

Arguments

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

msg: a Message

-> HTTPVersion

version: the HTTP version

-> m () 

Sets the HTTP version on msg. The default version is HTTPVersionHttp11. Setting it to HTTPVersionHttp10 will prevent certain functionality from being used.

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 () 

See the same-site spec for more information.

Since: 2.70

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 SessionSync (or with synchronous messages on a plain Session) because in the synchronous/blocking case, priority ends up being determined semi-randomly by thread scheduling.

Since: 2.44

setRedirect

messageSetRedirect Source #

Arguments

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

msg: a Message

-> Word32

statusCode: a 3xx status code

-> Text

redirectUri: the URI to redirect msg to

-> m () 

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

redirectUri can be a relative URI, in which case it is interpreted relative to msg's current URI. In particular, if redirectUri is just a path, it will replace the path <emphasis>and query</emphasis> of msg's URI.

Since: 2.38

setRequest

messageSetRequest Source #

Arguments

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

msg: the message

-> Maybe Text

contentType: MIME Content-Type of the body

-> MemoryUse

reqUse: a MemoryUse describing how to handle reqBody

-> Maybe ByteString

reqBody: a data buffer containing the body of the message request.

-> m () 

Convenience function to set the request body of a Message. If contentType is Nothing, the request body must be empty as well.

setResponse

messageSetResponse Source #

Arguments

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

msg: the message

-> Maybe Text

contentType: MIME Content-Type of the body

-> MemoryUse

respUse: a MemoryUse describing how to handle respBody

-> Maybe ByteString

respBody: a data buffer containing the body of the message response.

-> m () 

Convenience function to set the response body of a Message. If contentType is Nothing, the response body must be empty as well.

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.

Since: 2.70

setStatus

messageSetStatus Source #

Arguments

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

msg: a Message

-> Word32

statusCode: an HTTP status code

-> m () 

Sets msg's status code to statusCode. If statusCode is a known value, it will also set msg's reason_phrase.

setStatusFull

messageSetStatusFull Source #

Arguments

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

msg: a Message

-> Word32

statusCode: an HTTP status code

-> Text

reasonPhrase: a description of the status

-> m () 

Sets msg's status code and reason phrase.

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 call sessionRequeueMessage.

starting

messageStarting :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

wroteBody

messageWroteBody :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

wroteBodyData

messageWroteBodyData :: (HasCallStack, MonadIO m, IsMessage a) => a -> Buffer -> m () Source #

No description available in the introspection data.

wroteChunk

messageWroteChunk :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

wroteHeaders

messageWroteHeaders :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

wroteInformational

messageWroteInformational :: (HasCallStack, MonadIO m, IsMessage a) => a -> m () Source #

No description available in the introspection data.

Properties

firstParty

The URI loaded in the application when the message was queued.

Since: 2.30

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

No description available in the introspection data.

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

No description available in the introspection data.

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

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

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

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

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

set message [ #httpVersion := value ]

isTopLevelNavigation

Set when the message is navigating between top level domains.

Since: 2.70

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

No description available in the introspection data.

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

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

clear #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 (Maybe 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

No description available in the introspection data.

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

No description available in the introspection data.

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

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

clear #reasonPhrase

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

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

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

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

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

set message [ #reasonPhrase := value ]

requestBody

No description available in the introspection data.

getMessageRequestBody :: (MonadIO m, IsMessage o) => o -> m (Maybe MessageBody) Source #

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

get message #requestBody

requestBodyData

The message's HTTP request body, as a Bytes.

Since: 2.46

getMessageRequestBodyData :: (MonadIO m, IsMessage o) => o -> m (Maybe Bytes) Source #

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

get message #requestBodyData

requestHeaders

No description available in the introspection data.

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

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

get message #requestHeaders

responseBody

No description available in the introspection data.

getMessageResponseBody :: (MonadIO m, IsMessage o) => o -> m (Maybe MessageBody) Source #

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

get message #responseBody

responseBodyData

The message's HTTP response body, as a Bytes.

Since: 2.46

getMessageResponseBodyData :: (MonadIO m, IsMessage o) => o -> m (Maybe Bytes) Source #

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

get message #responseBodyData

responseHeaders

No description available in the introspection data.

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

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

get message #responseHeaders

serverSide

No description available in the introspection data.

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

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

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

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

get message #serverSide

siteForCookies

No description available in the introspection data.

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

No description available in the introspection data.

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

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

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

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

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

set message [ #statusCode := value ]

tlsCertificate

The TlsCertificate associated with the message

Since: 2.34

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

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

clear #tlsCertificate

constructMessageTlsCertificate :: (IsMessage o, MonadIO m, IsTlsCertificate a) => a -> m (GValueConstruct o) Source #

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

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

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

get message #tlsCertificate

setMessageTlsCertificate :: (MonadIO m, IsMessage o, IsTlsCertificate a) => o -> a -> m () Source #

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

set message [ #tlsCertificate := value ]

tlsErrors

The verification errors on Message:tlsCertificate

Since: 2.34

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

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

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

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

get message #tlsErrors

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

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

set message [ #tlsErrors := value ]

uri

No description available in the introspection data.

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

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 Message::gotHeaders, and before the first Message::gotChunk. 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 Message::gotHeaders, and type is Nothing.

If the ContentSniffer feature is enabled, and the sniffer decided to perform sniffing, the first Message::gotChunk emission may be delayed, so that the sniffer has enough data to correctly sniff the content. It notified the library user that the content has been sniffed, and allows it to change the header contents in the message, if desired.

After this signal is emitted, the data that was spooled so that sniffing could be done is delivered on the first emission of Message::gotChunk.

Since: 2.28

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 Message::got_body for client-side messages, or after Message::wrote_body for server-side messages.)

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 body. (For a server-side message, this means it has received the request body. For a client-side message, this means it has received the response body and is nearly done with the message.)

See also soup_message_add_header_handler() and soup_message_add_status_code_handler(), which can be used to connect to a subset of emissions of this signal.

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

gotChunk

type MessageGotChunkCallback Source #

Arguments

 = Buffer

chunk: the just-read chunk

-> IO () 

Emitted after receiving a chunk of a message body. Note that "chunk" in this context means any subpiece of the body, not necessarily the specific HTTP 1.1 chunks sent by the other side.

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.

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

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

after message #gotChunk 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.

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

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

on message #gotChunk callback

gotHeaders

type MessageGotHeadersCallback = IO () Source #

Emitted after receiving all message headers for a message. (For a client-side message, this is after receiving the Status-Line and response headers; for a server-side message, it is after receiving the Request-Line and request headers.)

See also soup_message_add_header_handler() and soup_message_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 Message::got_body handler rather than a Message::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

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.

Since: 2.38

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

restarted

type MessageRestartedCallback = IO () Source #

Emitted when a request that was already sent once is now being sent again (eg, 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.

Since: 2.50

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. (For a client-side message, this means that libsoup is done writing and is now waiting for the response from the server. For a server-side message, this means that libsoup has finished writing the response and is nearly done with the 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

 = Buffer

chunk: the data written

-> IO () 

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

Unlike Message::wrote_chunk, this is emitted after every successful write() call, not only after finishing a complete "chunk".

Since: 2.24

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

wroteChunk

type MessageWroteChunkCallback = IO () Source #

Emitted immediately after writing a body chunk for a message.

Note that this signal is not parallel to Message::got_chunk; it is emitted only when a complete chunk (added with soup_message_body_append() or messageBodyAppendBuffer) has been written. To get more useful continuous progress information, use Message::wrote_body_data.

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

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

after message #wroteChunk 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.

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

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

on message #wroteChunk callback

wroteHeaders

type MessageWroteHeadersCallback = IO () Source #

Emitted immediately after writing the headers for a message. (For a client-side message, this is after writing the request headers; for a server-side message, it is after writing the response headers.)

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

wroteInformational

type MessageWroteInformationalCallback = IO () Source #

Emitted immediately after writing a 1xx (Informational) response for a (server-side) message.

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

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

after message #wroteInformational 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.

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

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

on message #wroteInformational callback