Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
GI.Soup.Objects.Session
Contents
- Exported types
- Methods
- abort
- addFeature
- addFeatureByType
- cancelMessage
- getAsyncContext
- getFeature
- getFeatureForMessage
- getFeatures
- hasFeature
- new
- pauseMessage
- prefetchDns
- prepareForUri
- queueMessage
- redirectMessage
- removeFeature
- removeFeatureByType
- request
- requestHttp
- requestHttpUri
- requestUri
- requeueMessage
- send
- sendAsync
- sendFinish
- sendMessage
- stealConnection
- unpauseMessage
- websocketConnectAsync
- websocketConnectFinish
- wouldRedirect
- Properties
- Signals
Description
- newtype Session = Session (ManagedPtr Session)
- class GObject o => IsSession o
- toSession :: (MonadIO m, IsSession o) => o -> m Session
- noSession :: Maybe Session
- sessionAbort :: (HasCallStack, MonadIO m, IsSession a) => a -> m ()
- sessionAddFeature :: (HasCallStack, MonadIO m, IsSession a, IsSessionFeature b) => a -> b -> m ()
- sessionAddFeatureByType :: (HasCallStack, MonadIO m, IsSession a) => a -> GType -> m ()
- sessionCancelMessage :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> Word32 -> m ()
- sessionGetAsyncContext :: (HasCallStack, MonadIO m, IsSession a) => a -> m (Maybe MainContext)
- sessionGetFeature :: (HasCallStack, MonadIO m, IsSession a) => a -> GType -> m (Maybe SessionFeature)
- sessionGetFeatureForMessage :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> GType -> b -> m (Maybe SessionFeature)
- sessionGetFeatures :: (HasCallStack, MonadIO m, IsSession a) => a -> GType -> m [SessionFeature]
- sessionHasFeature :: (HasCallStack, MonadIO m, IsSession a) => a -> GType -> m Bool
- sessionNew :: (HasCallStack, MonadIO m) => m Session
- sessionPauseMessage :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> m ()
- sessionPrefetchDns :: (HasCallStack, MonadIO m, IsSession a, IsCancellable b) => a -> Text -> Maybe b -> Maybe AddressCallback -> m ()
- sessionPrepareForUri :: (HasCallStack, MonadIO m, IsSession a) => a -> URI -> m ()
- sessionQueueMessage :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> Maybe SessionCallback -> m ()
- sessionRedirectMessage :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> m Bool
- sessionRemoveFeature :: (HasCallStack, MonadIO m, IsSession a, IsSessionFeature b) => a -> b -> m ()
- sessionRemoveFeatureByType :: (HasCallStack, MonadIO m, IsSession a) => a -> GType -> m ()
- sessionRequest :: (HasCallStack, MonadIO m, IsSession a) => a -> Text -> m Request
- sessionRequestHttp :: (HasCallStack, MonadIO m, IsSession a) => a -> Text -> Text -> m RequestHTTP
- sessionRequestHttpUri :: (HasCallStack, MonadIO m, IsSession a) => a -> Text -> URI -> m RequestHTTP
- sessionRequestUri :: (HasCallStack, MonadIO m, IsSession a) => a -> URI -> m Request
- sessionRequeueMessage :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> m ()
- sessionSend :: (HasCallStack, MonadIO m, IsSession a, IsMessage b, IsCancellable c) => a -> b -> Maybe c -> m InputStream
- sessionSendAsync :: (HasCallStack, MonadIO m, IsSession a, IsMessage b, IsCancellable c) => a -> b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- sessionSendFinish :: (HasCallStack, MonadIO m, IsSession a, IsAsyncResult b) => a -> b -> m InputStream
- sessionSendMessage :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> m Word32
- sessionStealConnection :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> m IOStream
- sessionUnpauseMessage :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> m ()
- sessionWebsocketConnectAsync :: (HasCallStack, MonadIO m, IsSession a, IsMessage b, IsCancellable c) => a -> b -> Maybe Text -> Maybe [Text] -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- sessionWebsocketConnectFinish :: (HasCallStack, MonadIO m, IsSession a, IsAsyncResult b) => a -> b -> m WebsocketConnection
- sessionWouldRedirect :: (HasCallStack, MonadIO m, IsSession a, IsMessage b) => a -> b -> m Bool
- clearSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionAcceptLanguage :: IsSession o => Text -> IO (GValueConstruct o)
- getSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> m (Maybe Text)
- setSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> Text -> m ()
- constructSessionAcceptLanguageAuto :: IsSession o => Bool -> IO (GValueConstruct o)
- getSessionAcceptLanguageAuto :: (MonadIO m, IsSession o) => o -> m Bool
- setSessionAcceptLanguageAuto :: (MonadIO m, IsSession o) => o -> Bool -> m ()
- constructSessionAsyncContext :: IsSession o => Ptr () -> IO (GValueConstruct o)
- getSessionAsyncContext :: (MonadIO m, IsSession o) => o -> m (Ptr ())
- clearSessionHttpAliases :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionHttpAliases :: IsSession o => [Text] -> IO (GValueConstruct o)
- getSessionHttpAliases :: (MonadIO m, IsSession o) => o -> m (Maybe [Text])
- setSessionHttpAliases :: (MonadIO m, IsSession o) => o -> [Text] -> m ()
- clearSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionHttpsAliases :: IsSession o => [Text] -> IO (GValueConstruct o)
- getSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> m (Maybe [Text])
- setSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> [Text] -> m ()
- constructSessionIdleTimeout :: IsSession o => Word32 -> IO (GValueConstruct o)
- getSessionIdleTimeout :: (MonadIO m, IsSession o) => o -> m Word32
- setSessionIdleTimeout :: (MonadIO m, IsSession o) => o -> Word32 -> m ()
- constructSessionLocalAddress :: (IsSession o, IsAddress a) => a -> IO (GValueConstruct o)
- getSessionLocalAddress :: (MonadIO m, IsSession o) => o -> m (Maybe Address)
- constructSessionMaxConns :: IsSession o => Int32 -> IO (GValueConstruct o)
- getSessionMaxConns :: (MonadIO m, IsSession o) => o -> m Int32
- setSessionMaxConns :: (MonadIO m, IsSession o) => o -> Int32 -> m ()
- constructSessionMaxConnsPerHost :: IsSession o => Int32 -> IO (GValueConstruct o)
- getSessionMaxConnsPerHost :: (MonadIO m, IsSession o) => o -> m Int32
- setSessionMaxConnsPerHost :: (MonadIO m, IsSession o) => o -> Int32 -> m ()
- clearSessionProxyResolver :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionProxyResolver :: (IsSession o, IsProxyResolver a) => a -> IO (GValueConstruct o)
- getSessionProxyResolver :: (MonadIO m, IsSession o) => o -> m (Maybe ProxyResolver)
- setSessionProxyResolver :: (MonadIO m, IsSession o, IsProxyResolver a) => o -> a -> m ()
- clearSessionProxyUri :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionProxyUri :: IsSession o => URI -> IO (GValueConstruct o)
- getSessionProxyUri :: (MonadIO m, IsSession o) => o -> m (Maybe URI)
- setSessionProxyUri :: (MonadIO m, IsSession o) => o -> URI -> m ()
- clearSessionSslCaFile :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionSslCaFile :: IsSession o => Text -> IO (GValueConstruct o)
- getSessionSslCaFile :: (MonadIO m, IsSession o) => o -> m (Maybe Text)
- setSessionSslCaFile :: (MonadIO m, IsSession o) => o -> Text -> m ()
- constructSessionSslStrict :: IsSession o => Bool -> IO (GValueConstruct o)
- getSessionSslStrict :: (MonadIO m, IsSession o) => o -> m Bool
- setSessionSslStrict :: (MonadIO m, IsSession o) => o -> Bool -> m ()
- constructSessionSslUseSystemCaFile :: IsSession o => Bool -> IO (GValueConstruct o)
- getSessionSslUseSystemCaFile :: (MonadIO m, IsSession o) => o -> m Bool
- setSessionSslUseSystemCaFile :: (MonadIO m, IsSession o) => o -> Bool -> m ()
- constructSessionTimeout :: IsSession o => Word32 -> IO (GValueConstruct o)
- getSessionTimeout :: (MonadIO m, IsSession o) => o -> m Word32
- setSessionTimeout :: (MonadIO m, IsSession o) => o -> Word32 -> m ()
- clearSessionTlsDatabase :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionTlsDatabase :: (IsSession o, IsTlsDatabase a) => a -> IO (GValueConstruct o)
- getSessionTlsDatabase :: (MonadIO m, IsSession o) => o -> m (Maybe TlsDatabase)
- setSessionTlsDatabase :: (MonadIO m, IsSession o, IsTlsDatabase a) => o -> a -> m ()
- clearSessionTlsInteraction :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionTlsInteraction :: (IsSession o, IsTlsInteraction a) => a -> IO (GValueConstruct o)
- getSessionTlsInteraction :: (MonadIO m, IsSession o) => o -> m (Maybe TlsInteraction)
- setSessionTlsInteraction :: (MonadIO m, IsSession o, IsTlsInteraction a) => o -> a -> m ()
- constructSessionUseNtlm :: IsSession o => Bool -> IO (GValueConstruct o)
- getSessionUseNtlm :: (MonadIO m, IsSession o) => o -> m Bool
- setSessionUseNtlm :: (MonadIO m, IsSession o) => o -> Bool -> m ()
- constructSessionUseThreadContext :: IsSession o => Bool -> IO (GValueConstruct o)
- getSessionUseThreadContext :: (MonadIO m, IsSession o) => o -> m Bool
- setSessionUseThreadContext :: (MonadIO m, IsSession o) => o -> Bool -> m ()
- clearSessionUserAgent :: (MonadIO m, IsSession o) => o -> m ()
- constructSessionUserAgent :: IsSession o => Text -> IO (GValueConstruct o)
- getSessionUserAgent :: (MonadIO m, IsSession o) => o -> m (Maybe Text)
- setSessionUserAgent :: (MonadIO m, IsSession o) => o -> Text -> m ()
- type C_SessionAuthenticateCallback = Ptr () -> Ptr Message -> Ptr Auth -> CInt -> Ptr () -> IO ()
- type SessionAuthenticateCallback = Message -> Auth -> Bool -> IO ()
- afterSessionAuthenticate :: (IsSession a, MonadIO m) => a -> SessionAuthenticateCallback -> m SignalHandlerId
- genClosure_SessionAuthenticate :: SessionAuthenticateCallback -> IO Closure
- mk_SessionAuthenticateCallback :: C_SessionAuthenticateCallback -> IO (FunPtr C_SessionAuthenticateCallback)
- noSessionAuthenticateCallback :: Maybe SessionAuthenticateCallback
- onSessionAuthenticate :: (IsSession a, MonadIO m) => a -> SessionAuthenticateCallback -> m SignalHandlerId
- wrap_SessionAuthenticateCallback :: SessionAuthenticateCallback -> Ptr () -> Ptr Message -> Ptr Auth -> CInt -> Ptr () -> IO ()
- type C_SessionConnectionCreatedCallback = Ptr () -> Ptr Object -> Ptr () -> IO ()
- type SessionConnectionCreatedCallback = Object -> IO ()
- afterSessionConnectionCreated :: (IsSession a, MonadIO m) => a -> SessionConnectionCreatedCallback -> m SignalHandlerId
- genClosure_SessionConnectionCreated :: SessionConnectionCreatedCallback -> IO Closure
- mk_SessionConnectionCreatedCallback :: C_SessionConnectionCreatedCallback -> IO (FunPtr C_SessionConnectionCreatedCallback)
- noSessionConnectionCreatedCallback :: Maybe SessionConnectionCreatedCallback
- onSessionConnectionCreated :: (IsSession a, MonadIO m) => a -> SessionConnectionCreatedCallback -> m SignalHandlerId
- wrap_SessionConnectionCreatedCallback :: SessionConnectionCreatedCallback -> Ptr () -> Ptr Object -> Ptr () -> IO ()
- type C_SessionRequestQueuedCallback = Ptr () -> Ptr Message -> Ptr () -> IO ()
- type SessionRequestQueuedCallback = Message -> IO ()
- afterSessionRequestQueued :: (IsSession a, MonadIO m) => a -> SessionRequestQueuedCallback -> m SignalHandlerId
- genClosure_SessionRequestQueued :: SessionRequestQueuedCallback -> IO Closure
- mk_SessionRequestQueuedCallback :: C_SessionRequestQueuedCallback -> IO (FunPtr C_SessionRequestQueuedCallback)
- noSessionRequestQueuedCallback :: Maybe SessionRequestQueuedCallback
- onSessionRequestQueued :: (IsSession a, MonadIO m) => a -> SessionRequestQueuedCallback -> m SignalHandlerId
- wrap_SessionRequestQueuedCallback :: SessionRequestQueuedCallback -> Ptr () -> Ptr Message -> Ptr () -> IO ()
- type C_SessionRequestStartedCallback = Ptr () -> Ptr Message -> Ptr Socket -> Ptr () -> IO ()
- type SessionRequestStartedCallback = Message -> Socket -> IO ()
- afterSessionRequestStarted :: (IsSession a, MonadIO m) => a -> SessionRequestStartedCallback -> m SignalHandlerId
- genClosure_SessionRequestStarted :: SessionRequestStartedCallback -> IO Closure
- mk_SessionRequestStartedCallback :: C_SessionRequestStartedCallback -> IO (FunPtr C_SessionRequestStartedCallback)
- noSessionRequestStartedCallback :: Maybe SessionRequestStartedCallback
- onSessionRequestStarted :: (IsSession a, MonadIO m) => a -> SessionRequestStartedCallback -> m SignalHandlerId
- wrap_SessionRequestStartedCallback :: SessionRequestStartedCallback -> Ptr () -> Ptr Message -> Ptr Socket -> Ptr () -> IO ()
- type C_SessionRequestUnqueuedCallback = Ptr () -> Ptr Message -> Ptr () -> IO ()
- type SessionRequestUnqueuedCallback = Message -> IO ()
- afterSessionRequestUnqueued :: (IsSession a, MonadIO m) => a -> SessionRequestUnqueuedCallback -> m SignalHandlerId
- genClosure_SessionRequestUnqueued :: SessionRequestUnqueuedCallback -> IO Closure
- mk_SessionRequestUnqueuedCallback :: C_SessionRequestUnqueuedCallback -> IO (FunPtr C_SessionRequestUnqueuedCallback)
- noSessionRequestUnqueuedCallback :: Maybe SessionRequestUnqueuedCallback
- onSessionRequestUnqueued :: (IsSession a, MonadIO m) => a -> SessionRequestUnqueuedCallback -> m SignalHandlerId
- wrap_SessionRequestUnqueuedCallback :: SessionRequestUnqueuedCallback -> Ptr () -> Ptr Message -> Ptr () -> IO ()
- type C_SessionTunnelingCallback = Ptr () -> Ptr Object -> Ptr () -> IO ()
- type SessionTunnelingCallback = Object -> IO ()
- afterSessionTunneling :: (IsSession a, MonadIO m) => a -> SessionTunnelingCallback -> m SignalHandlerId
- genClosure_SessionTunneling :: SessionTunnelingCallback -> IO Closure
- mk_SessionTunnelingCallback :: C_SessionTunnelingCallback -> IO (FunPtr C_SessionTunnelingCallback)
- noSessionTunnelingCallback :: Maybe SessionTunnelingCallback
- onSessionTunneling :: (IsSession a, MonadIO m) => a -> SessionTunnelingCallback -> m SignalHandlerId
- wrap_SessionTunnelingCallback :: SessionTunnelingCallback -> Ptr () -> Ptr Object -> Ptr () -> IO ()
Exported types
Constructors
Session (ManagedPtr Session) |
Methods
abort
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> m () |
Cancels all pending requests in session
and closes all idle
persistent connections.
The message cancellation has the same semantics as with
sessionCancelMessage
; asynchronous requests on a
SessionAsync
will have their callback called before
sessionAbort
returns. Requests on a plain Session
will
not.
addFeature
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsSessionFeature b) | |
=> a |
|
-> b |
|
-> m () |
Adds feature
's functionality to session
. You can also add a
feature to the session at construct time by using the
SOUP_SESSION_ADD_FEATURE
property.
See the main Session
documentation for information on what
features are present in sessions by default.
Since: 2.24
addFeatureByType
sessionAddFeatureByType Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> GType |
|
-> m () |
If featureType
is the type of a class that implements
SessionFeature
, this creates a new feature of that type and
adds it to session
as with sessionAddFeature
. You can use
this when you don't need to customize the new feature in any way.
If featureType
is not a SessionFeature
type, this gives each
existing feature on session
the chance to accept featureType
as
a "subfeature". This can be used to add new Auth
or
Request
types, for instance.
You can also add a feature to the session at construct time by
using the SOUP_SESSION_ADD_FEATURE_BY_TYPE
property.
See the main Session
documentation for information on what
features are present in sessions by default.
Since: 2.24
cancelMessage
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> Word32 |
|
-> m () |
Causes session
to immediately finish processing msg
(regardless
of its current state) with a final status_code of statusCode
. You
may call this at any time after handing msg
off to session
; if
session
has started sending the request but has not yet received
the complete response, then it will close the request's connection.
Note that with requests that have side effects (eg,
<literal>POST</literal>, <literal>PUT</literal>,
<literal>DELETE</literal>) it is possible that you might cancel the
request after the server acts on it, but before it returns a
response, leaving the remote resource in an unknown state.
If the message is cancelled while its response body is being read,
then the response body in msg
will be left partially-filled-in.
The response headers, on the other hand, will always be either
empty or complete.
Beware that with the deprecated SessionAsync
, messages queued
with sessionQueueMessage
will have their callbacks invoked
before sessionCancelMessage
returns. The plain
Session
does not have this behavior; cancelling an
asynchronous message will merely queue its callback to be run after
returning to the main loop.
getAsyncContext
sessionGetAsyncContext Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> m (Maybe MainContext) | Returns: |
Gets session
's Session
:async-context
. This does not add a ref
to the context, so you will need to ref it yourself if you want it
to outlive its session.
For a modern Session
, this will always just return the
thread-default MainContext
, and so is not especially useful.
getFeature
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> GType |
|
-> m (Maybe SessionFeature) | Returns: a |
Gets the first feature in session
of type featureType
. For
features where there may be more than one feature of a given type,
use sessionGetFeatures
.
Since: 2.26
getFeatureForMessage
sessionGetFeatureForMessage Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> GType |
|
-> b |
|
-> m (Maybe SessionFeature) | Returns: a |
Gets the first feature in session
of type featureType
, provided
that it is not disabled for msg
. As with
sessionGetFeature
, this should only be used for features
where featureType
is only expected to match a single feature. In
particular, if there are two matching features, and the first is
disabled on msg
, and the second is not, then this will return
Nothing
, not the second feature.
Since: 2.28
getFeatures
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> GType |
|
-> m [SessionFeature] | Returns: a list of features. You must free the list, but not its contents |
Generates a list of session
's features of type featureType
. (If
you want to see all features, you can pass SOUP_TYPE_SESSION_FEATURE
for featureType
.)
Since: 2.26
hasFeature
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> GType |
|
-> m Bool |
Tests if session
has at a feature of type featureType
(which can
be the type of either a SessionFeature
, or else a subtype of
some class managed by another feature, such as Auth
or
Request
).
Since: 2.42
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Session | Returns: the new session. |
Creates a Session
with the default options.
Since: 2.42
pauseMessage
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> m () |
Pauses HTTP I/O on msg
. Call sessionUnpauseMessage
to
resume I/O.
This may only be called for asynchronous messages (those sent on a
SessionAsync
or using sessionQueueMessage
).
prefetchDns
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> Maybe b |
|
-> Maybe AddressCallback |
|
-> m () |
Tells session
that an URI from the given hostname
may be requested
shortly, and so the session can try to prepare by resolving the
domain name in advance, in order to work more quickly once the URI
is actually requested.
If cancellable
is non-Nothing
, it can be used to cancel the
resolution. callback
will still be invoked in this case, with a
status of StatusCancelled
.
Since: 2.38
prepareForUri
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> URI |
|
-> m () |
Deprecated: (Since version 2.38)use sessionPrefetchDns
instead
Tells session
that uri
may be requested shortly, and so the
session can try to prepare (resolving the domain name, obtaining
proxy address, etc.) in order to work more quickly once the URI is
actually requested.
Since: 2.30
queueMessage
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> Maybe SessionCallback |
|
-> m () |
Queues the message msg
for asynchronously sending the request and
receiving a response in the current thread-default MainContext
.
If msg
has been processed before, any resources related to the
time it was last sent are freed.
Upon message completion, the callback specified in callback
will
be invoked. If after returning from this callback the message has not
been requeued, msg
will be unreffed.
(The behavior above applies to a plain Session
; if you are
using SessionAsync
or SessionSync
, then the MainContext
that is used depends on the settings of Session
:async-context
and Session
:use-thread-context
, and for SessionSync
, the
message will actually be sent and processed in another thread, with
only the final callback occurring in the indicated MainContext
.)
Contrast this method with sessionSendAsync
, which also
asynchronously sends a message, but returns before reading the
response body, and allows you to read the response via a
InputStream
.
redirectMessage
sessionRedirectMessage Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: |
Updates msg
's URI according to its status code and "Location"
header, and requeues it on session
. Use this when you have set
MessageFlagsNoRedirect
on a message, but have decided to allow a
particular redirection to occur, or if you want to allow a
redirection that Session
will not perform automatically (eg,
redirecting a non-safe method such as DELETE).
If msg
's status code indicates that it should be retried as a GET
request, then msg
will be modified accordingly.
If msg
has already been redirected too many times, this will
cause it to fail with StatusTooManyRedirects
.
Since: 2.38
removeFeature
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsSessionFeature b) | |
=> a |
|
-> b |
|
-> m () |
Removes feature
's functionality from session
.
Since: 2.24
removeFeatureByType
sessionRemoveFeatureByType Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> GType |
|
-> m () |
Removes all features of type featureType
(or any subclass of
featureType
) from session
. You can also remove standard features
from the session at construct time by using the
SOUP_SESSION_REMOVE_FEATURE_BY_TYPE
property.
Since: 2.24
request
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> Text |
|
-> m Request | Returns: a new |
Creates a Request
for retrieving uriString
.
Since: 2.42
requestHttp
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m RequestHTTP | Returns: a new |
requestHttpUri
sessionRequestHttpUri Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> Text |
|
-> URI |
|
-> m RequestHTTP | Returns: a new |
requestUri
Arguments
:: (HasCallStack, MonadIO m, IsSession a) | |
=> a |
|
-> URI |
|
-> m Request | Returns: a new |
Creates a Request
for retrieving uri
.
Since: 2.42
requeueMessage
sessionRequeueMessage Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> m () |
This causes msg
to be placed back on the queue to be attempted
again.
send
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> m InputStream | Returns: a |
Synchronously sends msg
and waits for the beginning of a response.
On success, a InputStream
will be returned which you can use to
read the response body. ("Success" here means only that an HTTP
response was received and understood; it does not necessarily mean
that a 2xx class status code was received.)
If non-Nothing
, cancellable
can be used to cancel the request;
sessionSend
will return a IOErrorEnumCancelled
error. Note
that with requests that have side effects (eg,
<literal>POST</literal>, <literal>PUT</literal>,
<literal>DELETE</literal>) it is possible that you might cancel the
request after the server acts on it, but before it returns a
response, leaving the remote resource in an unknown state.
If msg
is requeued due to a redirect or authentication, the
initial (3xx/401/407) response body will be suppressed, and
sessionSend
will only return once a final response has been
received.
Contrast this method with sessionSendMessage
, which also
synchronously sends a Message
, but doesn't return until the
response has been completely read.
(Note that this method cannot be called on the deprecated
SessionAsync
subclass.)
Since: 2.42
sendAsync
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously sends msg
and waits for the beginning of a
response. When callback
is called, then either msg
has been sent,
and its response headers received, or else an error has occurred.
Call sessionSendFinish
to get a InputStream
for reading
the response body.
See sessionSend
for more details on the general semantics.
Contrast this method with sessionQueueMessage
, which also
asynchronously sends a Message
, but doesn't invoke its
callback until the response has been completely read.
(Note that this method cannot be called on the deprecated
SessionSync
subclass, and can only be called on
SessionAsync
if you have set the
Session
:use-thread-context
property.)
Since: 2.42
sendFinish
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m InputStream | Returns: a |
Gets the response to a sessionSendAsync
call and (if
successful), returns a InputStream
that can be used to read the
response body.
Since: 2.42
sendMessage
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> m Word32 | Returns: the HTTP status code of the response |
Synchronously send msg
. This call will not return until the
transfer is finished successfully or there is an unrecoverable
error.
Unlike with sessionQueueMessage
, msg
is not freed upon
return.
(Note that if you call this method on a SessionAsync
, it will
still use asynchronous I/O internally, running the glib main loop
to process the message, which may also cause other events to be
processed.)
Contrast this method with sessionSend
, which also
synchronously sends a message, but returns before reading the
response body, and allows you to read the response via a
InputStream
.
stealConnection
sessionStealConnection Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> m IOStream | Returns: the |
"Steals" the HTTP connection associated with msg
from session
.
This happens immediately, regardless of the current state of the
connection, and msg
's callback will not be called. You can steal
the connection from a Message
signal handler if you need to
wait for part or all of the response to be received first.
Calling this function may cause msg
to be freed if you are not
holding any other reference to it.
Since: 2.50
unpauseMessage
sessionUnpauseMessage Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> m () |
Resumes HTTP I/O on msg
. Use this to resume after calling
sessionPauseMessage
.
If msg
is being sent via blocking I/O, this will resume reading or
writing immediately. If msg
is using non-blocking I/O, then
reading or writing won't resume until you return to the main loop.
This may only be called for asynchronous messages (those sent on a
SessionAsync
or using sessionQueueMessage
).
websocketConnectAsync
sessionWebsocketConnectAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe Text |
|
-> Maybe [Text] |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously creates a WebsocketConnection
to communicate
with a remote server.
All necessary WebSocket-related headers will be added to msg
, and
it will then be sent and asynchronously processed normally
(including handling of redirection and HTTP authentication).
If the server returns "101 Switching Protocols", then msg
's status
code and response headers will be updated, and then the WebSocket
handshake will be completed. On success,
soup_websocket_connect_finish()
will return a new
WebsocketConnection
. On failure it will return a GError
.
If the server returns a status other than "101 Switching
Protocols", then msg
will contain the complete response headers
and body from the server's response, and
soup_websocket_connect_finish()
will return
WebsocketErrorNotWebsocket
.
Since: 2.50
websocketConnectFinish
sessionWebsocketConnectFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m WebsocketConnection | Returns: a new |
Gets the WebsocketConnection
response to a
sessionWebsocketConnectAsync
call and (if successful),
returns a SoupWebsockConnection
that can be used to communicate
with the server.
Since: 2.50
wouldRedirect
Arguments
:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: whether |
Checks if msg
contains a response that would cause session
to
redirect it to a new URL (ignoring msg
's MessageFlagsNoRedirect
flag, and the number of times it has already been redirected).
Since: 2.38
Properties
acceptLanguage
clearSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionAcceptLanguage :: IsSession o => Text -> IO (GValueConstruct o) Source #
acceptLanguageAuto
constructSessionAcceptLanguageAuto :: IsSession o => Bool -> IO (GValueConstruct o) Source #
asyncContext
constructSessionAsyncContext :: IsSession o => Ptr () -> IO (GValueConstruct o) Source #
httpAliases
clearSessionHttpAliases :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionHttpAliases :: IsSession o => [Text] -> IO (GValueConstruct o) Source #
httpsAliases
clearSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionHttpsAliases :: IsSession o => [Text] -> IO (GValueConstruct o) Source #
idleTimeout
constructSessionIdleTimeout :: IsSession o => Word32 -> IO (GValueConstruct o) Source #
localAddress
constructSessionLocalAddress :: (IsSession o, IsAddress a) => a -> IO (GValueConstruct o) Source #
maxConns
constructSessionMaxConns :: IsSession o => Int32 -> IO (GValueConstruct o) Source #
maxConnsPerHost
constructSessionMaxConnsPerHost :: IsSession o => Int32 -> IO (GValueConstruct o) Source #
proxyResolver
clearSessionProxyResolver :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionProxyResolver :: (IsSession o, IsProxyResolver a) => a -> IO (GValueConstruct o) Source #
getSessionProxyResolver :: (MonadIO m, IsSession o) => o -> m (Maybe ProxyResolver) Source #
setSessionProxyResolver :: (MonadIO m, IsSession o, IsProxyResolver a) => o -> a -> m () Source #
proxyUri
clearSessionProxyUri :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionProxyUri :: IsSession o => URI -> IO (GValueConstruct o) Source #
sslCaFile
clearSessionSslCaFile :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionSslCaFile :: IsSession o => Text -> IO (GValueConstruct o) Source #
sslStrict
constructSessionSslStrict :: IsSession o => Bool -> IO (GValueConstruct o) Source #
sslUseSystemCaFile
constructSessionSslUseSystemCaFile :: IsSession o => Bool -> IO (GValueConstruct o) Source #
timeout
constructSessionTimeout :: IsSession o => Word32 -> IO (GValueConstruct o) Source #
tlsDatabase
clearSessionTlsDatabase :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionTlsDatabase :: (IsSession o, IsTlsDatabase a) => a -> IO (GValueConstruct o) Source #
getSessionTlsDatabase :: (MonadIO m, IsSession o) => o -> m (Maybe TlsDatabase) Source #
setSessionTlsDatabase :: (MonadIO m, IsSession o, IsTlsDatabase a) => o -> a -> m () Source #
tlsInteraction
clearSessionTlsInteraction :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionTlsInteraction :: (IsSession o, IsTlsInteraction a) => a -> IO (GValueConstruct o) Source #
getSessionTlsInteraction :: (MonadIO m, IsSession o) => o -> m (Maybe TlsInteraction) Source #
setSessionTlsInteraction :: (MonadIO m, IsSession o, IsTlsInteraction a) => o -> a -> m () Source #
useNtlm
constructSessionUseNtlm :: IsSession o => Bool -> IO (GValueConstruct o) Source #
useThreadContext
constructSessionUseThreadContext :: IsSession o => Bool -> IO (GValueConstruct o) Source #
userAgent
clearSessionUserAgent :: (MonadIO m, IsSession o) => o -> m () Source #
constructSessionUserAgent :: IsSession o => Text -> IO (GValueConstruct o) Source #
Signals
authenticate
type C_SessionAuthenticateCallback = Ptr () -> Ptr Message -> Ptr Auth -> CInt -> Ptr () -> IO () Source #
afterSessionAuthenticate :: (IsSession a, MonadIO m) => a -> SessionAuthenticateCallback -> m SignalHandlerId Source #
mk_SessionAuthenticateCallback :: C_SessionAuthenticateCallback -> IO (FunPtr C_SessionAuthenticateCallback) Source #
onSessionAuthenticate :: (IsSession a, MonadIO m) => a -> SessionAuthenticateCallback -> m SignalHandlerId Source #
wrap_SessionAuthenticateCallback :: SessionAuthenticateCallback -> Ptr () -> Ptr Message -> Ptr Auth -> CInt -> Ptr () -> IO () Source #
connectionCreated
type SessionConnectionCreatedCallback = Object -> IO () Source #
afterSessionConnectionCreated :: (IsSession a, MonadIO m) => a -> SessionConnectionCreatedCallback -> m SignalHandlerId Source #
mk_SessionConnectionCreatedCallback :: C_SessionConnectionCreatedCallback -> IO (FunPtr C_SessionConnectionCreatedCallback) Source #
onSessionConnectionCreated :: (IsSession a, MonadIO m) => a -> SessionConnectionCreatedCallback -> m SignalHandlerId Source #
wrap_SessionConnectionCreatedCallback :: SessionConnectionCreatedCallback -> Ptr () -> Ptr Object -> Ptr () -> IO () Source #
requestQueued
type SessionRequestQueuedCallback = Message -> IO () Source #
afterSessionRequestQueued :: (IsSession a, MonadIO m) => a -> SessionRequestQueuedCallback -> m SignalHandlerId Source #
mk_SessionRequestQueuedCallback :: C_SessionRequestQueuedCallback -> IO (FunPtr C_SessionRequestQueuedCallback) Source #
onSessionRequestQueued :: (IsSession a, MonadIO m) => a -> SessionRequestQueuedCallback -> m SignalHandlerId Source #
wrap_SessionRequestQueuedCallback :: SessionRequestQueuedCallback -> Ptr () -> Ptr Message -> Ptr () -> IO () Source #
requestStarted
type C_SessionRequestStartedCallback = Ptr () -> Ptr Message -> Ptr Socket -> Ptr () -> IO () Source #
type SessionRequestStartedCallback = Message -> Socket -> IO () Source #
Deprecated: (Since version 2.50.)Use Message
::starting
instead.
afterSessionRequestStarted :: (IsSession a, MonadIO m) => a -> SessionRequestStartedCallback -> m SignalHandlerId Source #
mk_SessionRequestStartedCallback :: C_SessionRequestStartedCallback -> IO (FunPtr C_SessionRequestStartedCallback) Source #
onSessionRequestStarted :: (IsSession a, MonadIO m) => a -> SessionRequestStartedCallback -> m SignalHandlerId Source #
wrap_SessionRequestStartedCallback :: SessionRequestStartedCallback -> Ptr () -> Ptr Message -> Ptr Socket -> Ptr () -> IO () Source #
requestUnqueued
type SessionRequestUnqueuedCallback = Message -> IO () Source #
afterSessionRequestUnqueued :: (IsSession a, MonadIO m) => a -> SessionRequestUnqueuedCallback -> m SignalHandlerId Source #
mk_SessionRequestUnqueuedCallback :: C_SessionRequestUnqueuedCallback -> IO (FunPtr C_SessionRequestUnqueuedCallback) Source #
onSessionRequestUnqueued :: (IsSession a, MonadIO m) => a -> SessionRequestUnqueuedCallback -> m SignalHandlerId Source #
wrap_SessionRequestUnqueuedCallback :: SessionRequestUnqueuedCallback -> Ptr () -> Ptr Message -> Ptr () -> IO () Source #
tunneling
type SessionTunnelingCallback = Object -> IO () Source #
afterSessionTunneling :: (IsSession a, MonadIO m) => a -> SessionTunnelingCallback -> m SignalHandlerId Source #
mk_SessionTunnelingCallback :: C_SessionTunnelingCallback -> IO (FunPtr C_SessionTunnelingCallback) Source #
onSessionTunneling :: (IsSession a, MonadIO m) => a -> SessionTunnelingCallback -> m SignalHandlerId Source #
wrap_SessionTunnelingCallback :: SessionTunnelingCallback -> Ptr () -> Ptr Object -> Ptr () -> IO () Source #