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 |
- newtype Server = Server (ManagedPtr Server)
- class GObject o => IsServer o
- toServer :: IsServer o => o -> IO Server
- noServer :: Maybe Server
- data ServerAcceptIostreamMethodInfo
- serverAcceptIostream :: (HasCallStack, MonadIO m, IsServer a, IsIOStream b, IsSocketAddress c, IsSocketAddress d) => a -> b -> Maybe c -> Maybe d -> m ()
- data ServerAddAuthDomainMethodInfo
- serverAddAuthDomain :: (HasCallStack, MonadIO m, IsServer a, IsAuthDomain b) => a -> b -> m ()
- data ServerAddEarlyHandlerMethodInfo
- serverAddEarlyHandler :: (HasCallStack, MonadIO m, IsServer a) => a -> Maybe Text -> ServerCallback -> m ()
- data ServerAddHandlerMethodInfo
- serverAddHandler :: (HasCallStack, MonadIO m, IsServer a) => a -> Maybe Text -> ServerCallback -> m ()
- data ServerAddWebsocketHandlerMethodInfo
- serverAddWebsocketHandler :: (HasCallStack, MonadIO m, IsServer a) => a -> Maybe Text -> Maybe Text -> Maybe [Text] -> ServerWebsocketCallback -> m ()
- data ServerDisconnectMethodInfo
- serverDisconnect :: (HasCallStack, MonadIO m, IsServer a) => a -> m ()
- data ServerGetAsyncContextMethodInfo
- serverGetAsyncContext :: (HasCallStack, MonadIO m, IsServer a) => a -> m (Maybe MainContext)
- data ServerGetListenerMethodInfo
- serverGetListener :: (HasCallStack, MonadIO m, IsServer a) => a -> m Socket
- data ServerGetListenersMethodInfo
- serverGetListeners :: (HasCallStack, MonadIO m, IsServer a) => a -> m [Socket]
- data ServerGetPortMethodInfo
- serverGetPort :: (HasCallStack, MonadIO m, IsServer a) => a -> m Word32
- data ServerGetUrisMethodInfo
- serverGetUris :: (HasCallStack, MonadIO m, IsServer a) => a -> m [URI]
- data ServerIsHttpsMethodInfo
- serverIsHttps :: (HasCallStack, MonadIO m, IsServer a) => a -> m Bool
- data ServerListenMethodInfo
- serverListen :: (HasCallStack, MonadIO m, IsServer a, IsSocketAddress b) => a -> b -> [ServerListenOptions] -> m ()
- data ServerListenAllMethodInfo
- serverListenAll :: (HasCallStack, MonadIO m, IsServer a) => a -> Word32 -> [ServerListenOptions] -> m ()
- data ServerListenFdMethodInfo
- serverListenFd :: (HasCallStack, MonadIO m, IsServer a) => a -> Int32 -> [ServerListenOptions] -> m ()
- data ServerListenLocalMethodInfo
- serverListenLocal :: (HasCallStack, MonadIO m, IsServer a) => a -> Word32 -> [ServerListenOptions] -> m ()
- data ServerListenSocketMethodInfo
- serverListenSocket :: (HasCallStack, MonadIO m, IsServer a, IsSocket b) => a -> b -> [ServerListenOptions] -> m ()
- data ServerPauseMessageMethodInfo
- serverPauseMessage :: (HasCallStack, MonadIO m, IsServer a, IsMessage b) => a -> b -> m ()
- data ServerQuitMethodInfo
- serverQuit :: (HasCallStack, MonadIO m, IsServer a) => a -> m ()
- data ServerRemoveAuthDomainMethodInfo
- serverRemoveAuthDomain :: (HasCallStack, MonadIO m, IsServer a, IsAuthDomain b) => a -> b -> m ()
- data ServerRemoveHandlerMethodInfo
- serverRemoveHandler :: (HasCallStack, MonadIO m, IsServer a) => a -> Text -> m ()
- data ServerRunMethodInfo
- serverRun :: (HasCallStack, MonadIO m, IsServer a) => a -> m ()
- data ServerRunAsyncMethodInfo
- serverRunAsync :: (HasCallStack, MonadIO m, IsServer a) => a -> m ()
- data ServerSetSslCertFileMethodInfo
- serverSetSslCertFile :: (HasCallStack, MonadIO m, IsServer a) => a -> Text -> Text -> m ()
- data ServerUnpauseMessageMethodInfo
- serverUnpauseMessage :: (HasCallStack, MonadIO m, IsServer a, IsMessage b) => a -> b -> m ()
- data ServerAsyncContextPropertyInfo
- constructServerAsyncContext :: IsServer o => Ptr () -> IO (GValueConstruct o)
- getServerAsyncContext :: (MonadIO m, IsServer o) => o -> m (Ptr ())
- serverAsyncContext :: AttrLabelProxy "asyncContext"
- data ServerHttpAliasesPropertyInfo
- clearServerHttpAliases :: (MonadIO m, IsServer o) => o -> m ()
- constructServerHttpAliases :: IsServer o => [Text] -> IO (GValueConstruct o)
- getServerHttpAliases :: (MonadIO m, IsServer o) => o -> m (Maybe [Text])
- serverHttpAliases :: AttrLabelProxy "httpAliases"
- setServerHttpAliases :: (MonadIO m, IsServer o) => o -> [Text] -> m ()
- data ServerHttpsAliasesPropertyInfo
- clearServerHttpsAliases :: (MonadIO m, IsServer o) => o -> m ()
- constructServerHttpsAliases :: IsServer o => [Text] -> IO (GValueConstruct o)
- getServerHttpsAliases :: (MonadIO m, IsServer o) => o -> m (Maybe [Text])
- serverHttpsAliases :: AttrLabelProxy "httpsAliases"
- setServerHttpsAliases :: (MonadIO m, IsServer o) => o -> [Text] -> m ()
- data ServerInterfacePropertyInfo
- constructServerInterface :: (IsServer o, IsAddress a) => a -> IO (GValueConstruct o)
- getServerInterface :: (MonadIO m, IsServer o) => o -> m (Maybe Address)
- serverInterface :: AttrLabelProxy "interface"
- data ServerPortPropertyInfo
- constructServerPort :: IsServer o => Word32 -> IO (GValueConstruct o)
- getServerPort :: (MonadIO m, IsServer o) => o -> m Word32
- serverPort :: AttrLabelProxy "port"
- data ServerRawPathsPropertyInfo
- constructServerRawPaths :: IsServer o => Bool -> IO (GValueConstruct o)
- getServerRawPaths :: (MonadIO m, IsServer o) => o -> m Bool
- serverRawPaths :: AttrLabelProxy "rawPaths"
- data ServerServerHeaderPropertyInfo
- clearServerServerHeader :: (MonadIO m, IsServer o) => o -> m ()
- constructServerServerHeader :: IsServer o => Text -> IO (GValueConstruct o)
- getServerServerHeader :: (MonadIO m, IsServer o) => o -> m (Maybe Text)
- serverServerHeader :: AttrLabelProxy "serverHeader"
- setServerServerHeader :: (MonadIO m, IsServer o) => o -> Text -> m ()
- data ServerSslCertFilePropertyInfo
- constructServerSslCertFile :: IsServer o => Text -> IO (GValueConstruct o)
- getServerSslCertFile :: (MonadIO m, IsServer o) => o -> m (Maybe Text)
- serverSslCertFile :: AttrLabelProxy "sslCertFile"
- data ServerSslKeyFilePropertyInfo
- constructServerSslKeyFile :: IsServer o => Text -> IO (GValueConstruct o)
- getServerSslKeyFile :: (MonadIO m, IsServer o) => o -> m (Maybe Text)
- serverSslKeyFile :: AttrLabelProxy "sslKeyFile"
- data ServerTlsCertificatePropertyInfo
- constructServerTlsCertificate :: (IsServer o, IsTlsCertificate a) => a -> IO (GValueConstruct o)
- getServerTlsCertificate :: (MonadIO m, IsServer o) => o -> m (Maybe TlsCertificate)
- serverTlsCertificate :: AttrLabelProxy "tlsCertificate"
- type C_ServerRequestAbortedCallback = Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO ()
- type ServerRequestAbortedCallback = Message -> ClientContext -> IO ()
- data ServerRequestAbortedSignalInfo
- afterServerRequestAborted :: (GObject a, MonadIO m) => a -> ServerRequestAbortedCallback -> m SignalHandlerId
- genClosure_ServerRequestAborted :: ServerRequestAbortedCallback -> IO Closure
- mk_ServerRequestAbortedCallback :: C_ServerRequestAbortedCallback -> IO (FunPtr C_ServerRequestAbortedCallback)
- noServerRequestAbortedCallback :: Maybe ServerRequestAbortedCallback
- onServerRequestAborted :: (GObject a, MonadIO m) => a -> ServerRequestAbortedCallback -> m SignalHandlerId
- wrap_ServerRequestAbortedCallback :: ServerRequestAbortedCallback -> Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO ()
- type C_ServerRequestFinishedCallback = Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO ()
- type ServerRequestFinishedCallback = Message -> ClientContext -> IO ()
- data ServerRequestFinishedSignalInfo
- afterServerRequestFinished :: (GObject a, MonadIO m) => a -> ServerRequestFinishedCallback -> m SignalHandlerId
- genClosure_ServerRequestFinished :: ServerRequestFinishedCallback -> IO Closure
- mk_ServerRequestFinishedCallback :: C_ServerRequestFinishedCallback -> IO (FunPtr C_ServerRequestFinishedCallback)
- noServerRequestFinishedCallback :: Maybe ServerRequestFinishedCallback
- onServerRequestFinished :: (GObject a, MonadIO m) => a -> ServerRequestFinishedCallback -> m SignalHandlerId
- wrap_ServerRequestFinishedCallback :: ServerRequestFinishedCallback -> Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO ()
- type C_ServerRequestReadCallback = Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO ()
- type ServerRequestReadCallback = Message -> ClientContext -> IO ()
- data ServerRequestReadSignalInfo
- afterServerRequestRead :: (GObject a, MonadIO m) => a -> ServerRequestReadCallback -> m SignalHandlerId
- genClosure_ServerRequestRead :: ServerRequestReadCallback -> IO Closure
- mk_ServerRequestReadCallback :: C_ServerRequestReadCallback -> IO (FunPtr C_ServerRequestReadCallback)
- noServerRequestReadCallback :: Maybe ServerRequestReadCallback
- onServerRequestRead :: (GObject a, MonadIO m) => a -> ServerRequestReadCallback -> m SignalHandlerId
- wrap_ServerRequestReadCallback :: ServerRequestReadCallback -> Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO ()
- type C_ServerRequestStartedCallback = Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO ()
- type ServerRequestStartedCallback = Message -> ClientContext -> IO ()
- data ServerRequestStartedSignalInfo
- afterServerRequestStarted :: (GObject a, MonadIO m) => a -> ServerRequestStartedCallback -> m SignalHandlerId
- genClosure_ServerRequestStarted :: ServerRequestStartedCallback -> IO Closure
- mk_ServerRequestStartedCallback :: C_ServerRequestStartedCallback -> IO (FunPtr C_ServerRequestStartedCallback)
- noServerRequestStartedCallback :: Maybe ServerRequestStartedCallback
- onServerRequestStarted :: (GObject a, MonadIO m) => a -> ServerRequestStartedCallback -> m SignalHandlerId
- wrap_ServerRequestStartedCallback :: ServerRequestStartedCallback -> Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO ()
Exported types
GObject Server Source # | |
IsObject Server Source # | |
IsServer Server Source # | |
((~) * info (ResolveServerMethod t Server), MethodInfo * info Server p) => IsLabel t (Server -> p) Source # | |
((~) * info (ResolveServerMethod t Server), MethodInfo * info Server p) => IsLabelProxy t (Server -> p) Source # | |
HasAttributeList * Server Source # | |
type AttributeList Server Source # | |
type SignalList Server Source # | |
Methods
acceptIostream
data ServerAcceptIostreamMethodInfo Source #
((~) * signature (b -> Maybe c -> Maybe d -> m ()), MonadIO m, IsServer a, IsIOStream b, IsSocketAddress c, IsSocketAddress d) => MethodInfo * ServerAcceptIostreamMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a, IsIOStream b, IsSocketAddress c, IsSocketAddress d) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> Maybe d |
|
-> m () | (Can throw |
Add a new client stream to the server
.
Since: 2.50
addAuthDomain
data ServerAddAuthDomainMethodInfo Source #
((~) * signature (b -> m ()), MonadIO m, IsServer a, IsAuthDomain b) => MethodInfo * ServerAddAuthDomainMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a, IsAuthDomain b) | |
=> a |
|
-> b |
|
-> m () |
Adds an authentication domain to server
. Each auth domain will
have the chance to require authentication for each request that
comes in; normally auth domains will require authentication for
requests on certain paths that they have been set up to watch, or
that meet other criteria set by the caller. If an auth domain
determines that a request requires authentication (and the request
doesn't contain authentication), server
will automatically reject
the request with an appropriate status (401 Unauthorized or 407
Proxy Authentication Required). If the request used the
"100-continue" Expectation, server
will reject it before the
request body is sent.
addEarlyHandler
data ServerAddEarlyHandlerMethodInfo Source #
((~) * signature (Maybe Text -> ServerCallback -> m ()), MonadIO m, IsServer a) => MethodInfo * ServerAddEarlyHandlerMethodInfo a signature Source # | |
serverAddEarlyHandler Source #
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> Maybe Text |
|
-> ServerCallback |
|
-> m () |
Adds an "early" handler to server
for requests under path
. Note
that "normal" and "early" handlers are matched up together, so if
you add a normal handler for "/foo" and an early handler for
"/foo/bar", then a request to "/foo/bar" (or any path below it)
will run only the early handler. (But if you add both handlers at
the same path, then both will get run.)
For requests under path
(that have not already been assigned a
status code by a AuthDomain
or a signal handler), callback
will be invoked after receiving the request headers, but before
receiving the request body; the message's Message
:method
and
Message
:request-headers
fields will be filled in.
Early handlers are generally used for processing requests with
request bodies in a streaming fashion. If you determine that the
request will contain a message body, normally you would call
messageBodySetAccumulate
on the message's
Message
:request-body
to turn off request-body accumulation,
and connect to the message's Message
::got-chunk
signal to
process each chunk as it comes in.
To complete the message processing after the full message body has
been read, you can either also connect to Message
::got-body
,
or else you can register a non-early handler for path
as well. As
long as you have not set the Message
:status-code
by the time
Message
::got-body
is emitted, the non-early handler will be
run as well.
Since: 2.50
addHandler
data ServerAddHandlerMethodInfo Source #
((~) * signature (Maybe Text -> ServerCallback -> m ()), MonadIO m, IsServer a) => MethodInfo * ServerAddHandlerMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> Maybe Text |
|
-> ServerCallback |
|
-> m () |
Adds a handler to server
for requests under path
. If path
is
Nothing
or "/", then this will be the default handler for all
requests that don't have a more specific handler. (Note though that
if you want to handle requests to the special "*" URI, you must
explicitly register a handler for "*"; the default handler will not
be used for that case.)
For requests under path
(that have not already been assigned a
status code by a AuthDomain
, an early SoupServerHandler
, or a
signal handler), callback
will be invoked after receiving the
request body; the message's Message
:method
,
Message
:request-headers
, and Message
:request-body
fields
will be filled in.
After determining what to do with the request, the callback must at
a minimum call messageSetStatus
(or
messageSetStatusFull
) on the message to set the response
status code. Additionally, it may set response headers and/or fill
in the response body.
If the callback cannot fully fill in the response before returning
(eg, if it needs to wait for information from a database, or
another network server), it should call serverPauseMessage
to tell server
to not send the response right away. When the
response is ready, call serverUnpauseMessage
to cause it
to be sent.
To send the response body a bit at a time using "chunked" encoding,
first call messageHeadersSetEncoding
to set
EncodingChunked
on the Message
:response-headers
. Then call
soup_message_body_append()
(or messageBodyAppendBuffer
)
to append each chunk as it becomes ready, and
serverUnpauseMessage
to make sure it's running. (The
server will automatically pause the message if it is using chunked
encoding but no more chunks are available.) When you are done, call
messageBodyComplete
to indicate that no more chunks are
coming.
addWebsocketHandler
data ServerAddWebsocketHandlerMethodInfo Source #
((~) * signature (Maybe Text -> Maybe Text -> Maybe [Text] -> ServerWebsocketCallback -> m ()), MonadIO m, IsServer a) => MethodInfo * ServerAddWebsocketHandlerMethodInfo a signature Source # | |
serverAddWebsocketHandler Source #
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Maybe [Text] |
|
-> ServerWebsocketCallback |
|
-> m () |
Adds a WebSocket handler to server
for requests under path
. (If
path
is Nothing
or "/", then this will be the default handler for
all requests that don't have a more specific handler.)
When a path has a WebSocket handler registered, server
will check
incoming requests for WebSocket handshakes after all other handlers
have run (unless some earlier handler has already set a status code
on the message), and update the request's status, response headers,
and response body accordingly.
If origin
is non-Nothing
, then only requests containing a matching
"Origin" header will be accepted. If protocols
is non-Nothing
, then
only requests containing a compatible "Sec-WebSocket-Protocols"
header will be accepted. More complicated requirements can be
handled by adding a normal handler to path
, and having it perform
whatever checks are needed (possibly calling
soup_server_check_websocket_handshake()
one or more times), and
setting a failure status code if the handshake should be rejected.
disconnect
data ServerDisconnectMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsServer a) => MethodInfo * ServerDisconnectMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m () |
Closes and frees server
's listening sockets. If you are using the
old Server
APIs, this also includes the effect of
serverQuit
.
Note that if there are currently requests in progress on server
,
that they will continue to be processed if server
's MainContext
is still running.
You can call serverListen
, etc, after calling this function
if you want to start listening again.
getAsyncContext
data ServerGetAsyncContextMethodInfo Source #
((~) * signature (m (Maybe MainContext)), MonadIO m, IsServer a) => MethodInfo * ServerGetAsyncContextMethodInfo a signature Source # | |
serverGetAsyncContext Source #
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m (Maybe MainContext) | Returns: |
Deprecated: If you are using serverListen
, etc, thenthe server listens on the thread-default MainContext
, and thisproperty is ignored.
Gets server
's async_context, if you are using the old API. (With
the new API, the server runs in the thread's thread-default
MainContext
, regardless of what this method returns.)
This does not add a ref to the context, so you will need to ref it yourself if you want it to outlive its server.
getListener
data ServerGetListenerMethodInfo Source #
((~) * signature (m Socket), MonadIO m, IsServer a) => MethodInfo * ServerGetListenerMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m Socket | Returns: the listening socket. |
Deprecated: If you are using serverListen
, etc, then useserverGetListeners
to get a list of all listening sockets,but note that that function returns GSockets
, not SoupSockets
.
Gets server
's listening socket, if you are using the old API.
You should treat this socket as read-only; writing to it or
modifiying it may cause server
to malfunction.
getListeners
data ServerGetListenersMethodInfo Source #
((~) * signature (m [Socket]), MonadIO m, IsServer a) => MethodInfo * ServerGetListenersMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m [Socket] | Returns: a list of listening sockets. |
Gets server
's list of listening sockets.
You should treat these sockets as read-only; writing to or
modifiying any of these sockets may cause server
to malfunction.
(Beware that in contrast to the old serverGetListener
, this
function returns GSockets
, not SoupSockets
.)
getPort
data ServerGetPortMethodInfo Source #
((~) * signature (m Word32), MonadIO m, IsServer a) => MethodInfo * ServerGetPortMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m Word32 | Returns: the port |
Deprecated: If you are using serverListen
, etc, then useserverGetUris
to get a list of all listening addresses.
Gets the TCP port that server
is listening on, if you are using
the old API.
getUris
data ServerGetUrisMethodInfo Source #
((~) * signature (m [URI]), MonadIO m, IsServer a) => MethodInfo * ServerGetUrisMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m [URI] | Returns: a list of
|
Gets a list of URIs corresponding to the interfaces server
is
listening on. These will contain IP addresses, not hostnames, and
will also indicate whether the given listener is http or https.
Note that if you used serverListenAll
, the returned URIs
will use the addresses <literal>0.0.0.0</literal> and
<literal>::</literal>, rather than actually returning separate URIs
for each interface on the system.
Since: 2.48
isHttps
data ServerIsHttpsMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsServer a) => MethodInfo * ServerIsHttpsMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m Bool | Returns: |
Checks whether server
is capable of https.
In order for a server to run https, you must call
serverSetSslCertFile
, or set the
Server
:tls-certificate
property, to provide it with a
certificate to use.
If you are using the deprecated single-listener APIs, then a return
value of True
indicates that the Server
serves https
exclusively. If you are using serverListen
, etc, then a
True
return value merely indicates that the server is
<emphasis>able</emphasis> to do https, regardless of whether it
actually currently is or not. Use serverGetUris
to see if
it currently has any https listeners.
listen
data ServerListenMethodInfo Source #
((~) * signature (b -> [ServerListenOptions] -> m ()), MonadIO m, IsServer a, IsSocketAddress b) => MethodInfo * ServerListenMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a, IsSocketAddress b) | |
=> a |
|
-> b |
|
-> [ServerListenOptions] |
|
-> m () | (Can throw |
This attempts to set up server
to listen for connections on
address
.
If options
includes ServerListenOptionsHttps
, and server
has
been configured for TLS, then server
will listen for https
connections on this port. Otherwise it will listen for plain http.
You may call this method (along with the other "listen" methods) any number of times on a server, if you want to listen on multiple ports, or set up both http and https service.
After calling this method, server
will begin accepting and
processing connections as soon as the appropriate MainContext
is
run.
Note that Server
never makes use of dual IPv4/IPv6 sockets; if
address
is an IPv6 address, it will only accept IPv6 connections.
You must configure IPv4 listening separately.
Since: 2.48
listenAll
data ServerListenAllMethodInfo Source #
((~) * signature (Word32 -> [ServerListenOptions] -> m ()), MonadIO m, IsServer a) => MethodInfo * ServerListenAllMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> Word32 |
|
-> [ServerListenOptions] |
|
-> m () | (Can throw |
This attempts to set up server
to listen for connections on all
interfaces on the system. (That is, it listens on the addresses
<literal>0.0.0.0</literal> and/or <literal>::</literal>, depending
on whether options
includes ServerListenOptionsIpv4Only
,
ServerListenOptionsIpv6Only
, or neither.) If port
is specified,
server
will listen on that port. If it is 0, server
will find an
unused port to listen on. (In that case, you can use
serverGetUris
to find out what port it ended up choosing.)
See serverListen
for more details.
Since: 2.48
listenFd
data ServerListenFdMethodInfo Source #
((~) * signature (Int32 -> [ServerListenOptions] -> m ()), MonadIO m, IsServer a) => MethodInfo * ServerListenFdMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> Int32 |
|
-> [ServerListenOptions] |
|
-> m () | (Can throw |
This attempts to set up server
to listen for connections on
fd
.
See serverListen
for more details.
Note that server
will close fd
when you free it or call
serverDisconnect
.
Since: 2.48
listenLocal
data ServerListenLocalMethodInfo Source #
((~) * signature (Word32 -> [ServerListenOptions] -> m ()), MonadIO m, IsServer a) => MethodInfo * ServerListenLocalMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> Word32 |
|
-> [ServerListenOptions] |
|
-> m () | (Can throw |
This attempts to set up server
to listen for connections on
"localhost" (that is, <literal>127.0.0.1</literal> and/or
<literal>::1</literal>, depending on whether options
includes
ServerListenOptionsIpv4Only
, ServerListenOptionsIpv6Only
, or
neither). If port
is specified, server
will listen on that port.
If it is 0, server
will find an unused port to listen on. (In that
case, you can use serverGetUris
to find out what port it
ended up choosing.)
See serverListen
for more details.
Since: 2.48
listenSocket
data ServerListenSocketMethodInfo Source #
((~) * signature (b -> [ServerListenOptions] -> m ()), MonadIO m, IsServer a, IsSocket b) => MethodInfo * ServerListenSocketMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a, IsSocket b) | |
=> a |
|
-> b |
|
-> [ServerListenOptions] |
|
-> m () | (Can throw |
This attempts to set up server
to listen for connections on
socket
.
See serverListen
for more details.
Since: 2.48
pauseMessage
data ServerPauseMessageMethodInfo Source #
((~) * signature (b -> m ()), MonadIO m, IsServer a, IsMessage b) => MethodInfo * ServerPauseMessageMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a, IsMessage b) | |
=> a |
|
-> b |
|
-> m () |
Pauses I/O on msg
. This can be used when you need to return from
the server handler without having the full response ready yet. Use
serverUnpauseMessage
to resume I/O.
This must only be called on SoupMessages
which were created by the
Server
and are currently doing I/O, such as those passed into a
ServerCallback
or emitted in a Server
::request-read
signal.
quit
data ServerQuitMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsServer a) => MethodInfo * ServerQuitMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m () |
Deprecated: When using serverListen
, etc, the server willalways listen for connections, and will process them whenever thethread-default MainContext
is running.
Stops processing for server
, if you are using the old API. Call
this to clean up after serverRunAsync
, or to terminate a
call to serverRun
.
Note that messages currently in progress will continue to be handled, if the main loop associated with the server is resumed or kept running.
server
is still in a working state after this call; you can start
and stop a server as many times as you want.
removeAuthDomain
data ServerRemoveAuthDomainMethodInfo Source #
((~) * signature (b -> m ()), MonadIO m, IsServer a, IsAuthDomain b) => MethodInfo * ServerRemoveAuthDomainMethodInfo a signature Source # | |
serverRemoveAuthDomain Source #
:: (HasCallStack, MonadIO m, IsServer a, IsAuthDomain b) | |
=> a |
|
-> b |
|
-> m () |
Removes authDomain
from server
.
removeHandler
data ServerRemoveHandlerMethodInfo Source #
((~) * signature (Text -> m ()), MonadIO m, IsServer a) => MethodInfo * ServerRemoveHandlerMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> Text |
|
-> m () |
Removes all handlers (early and normal) registered at path
.
run
data ServerRunMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsServer a) => MethodInfo * ServerRunMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m () |
Deprecated: When using serverListen
, etc, the server willalways listen for connections, and will process them whenever thethread-default MainContext
is running.
Starts server
, if you are using the old API, causing it to listen
for and process incoming connections. Unlike
serverRunAsync
, this creates a MainLoop
and runs it, and
it will not return until someone calls serverQuit
to stop
the server.
runAsync
data ServerRunAsyncMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsServer a) => MethodInfo * ServerRunAsyncMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> m () |
Deprecated: When using serverListen
, etc, the server willalways listen for connections, and will process them whenever thethread-default MainContext
is running.
Starts server
, if you are using the old API, causing it to listen
for and process incoming connections.
The server runs in server
's MainContext
. It will not actually
perform any processing unless the appropriate main loop is running.
In the simple case where you did not set the server's
SERVER_ASYNC_CONTEXT
property, this means the server will run
whenever the glib main loop is running.
setSslCertFile
data ServerSetSslCertFileMethodInfo Source #
((~) * signature (Text -> Text -> m ()), MonadIO m, IsServer a) => MethodInfo * ServerSetSslCertFileMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () | (Can throw |
Sets server
up to do https, using the SSL/TLS certificate
specified by sslCertFile
and sslKeyFile
(which may point to
the same file).
Alternatively, you can set the Server
:tls-certificate
property
at construction time, if you already have a TlsCertificate
.
Since: 2.48
unpauseMessage
data ServerUnpauseMessageMethodInfo Source #
((~) * signature (b -> m ()), MonadIO m, IsServer a, IsMessage b) => MethodInfo * ServerUnpauseMessageMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsServer a, IsMessage b) | |
=> a |
|
-> b |
|
-> m () |
Resumes I/O on msg
. Use this to resume after calling
serverPauseMessage
, or after adding a new chunk to a
chunked response.
I/O won't actually resume until you return to the main loop.
This must only be called on SoupMessages
which were created by the
Server
and are currently doing I/O, such as those passed into a
ServerCallback
or emitted in a Server
::request-read
signal.
Properties
asyncContext
data ServerAsyncContextPropertyInfo Source #
constructServerAsyncContext :: IsServer o => Ptr () -> IO (GValueConstruct o) Source #
serverAsyncContext :: AttrLabelProxy "asyncContext" Source #
httpAliases
data ServerHttpAliasesPropertyInfo Source #
clearServerHttpAliases :: (MonadIO m, IsServer o) => o -> m () Source #
constructServerHttpAliases :: IsServer o => [Text] -> IO (GValueConstruct o) Source #
serverHttpAliases :: AttrLabelProxy "httpAliases" Source #
httpsAliases
data ServerHttpsAliasesPropertyInfo Source #
clearServerHttpsAliases :: (MonadIO m, IsServer o) => o -> m () Source #
constructServerHttpsAliases :: IsServer o => [Text] -> IO (GValueConstruct o) Source #
serverHttpsAliases :: AttrLabelProxy "httpsAliases" Source #
interface
data ServerInterfacePropertyInfo Source #
constructServerInterface :: (IsServer o, IsAddress a) => a -> IO (GValueConstruct o) Source #
serverInterface :: AttrLabelProxy "interface" Source #
port
data ServerPortPropertyInfo Source #
constructServerPort :: IsServer o => Word32 -> IO (GValueConstruct o) Source #
serverPort :: AttrLabelProxy "port" Source #
rawPaths
data ServerRawPathsPropertyInfo Source #
constructServerRawPaths :: IsServer o => Bool -> IO (GValueConstruct o) Source #
serverRawPaths :: AttrLabelProxy "rawPaths" Source #
serverHeader
data ServerServerHeaderPropertyInfo Source #
clearServerServerHeader :: (MonadIO m, IsServer o) => o -> m () Source #
constructServerServerHeader :: IsServer o => Text -> IO (GValueConstruct o) Source #
serverServerHeader :: AttrLabelProxy "serverHeader" Source #
sslCertFile
data ServerSslCertFilePropertyInfo Source #
constructServerSslCertFile :: IsServer o => Text -> IO (GValueConstruct o) Source #
serverSslCertFile :: AttrLabelProxy "sslCertFile" Source #
sslKeyFile
data ServerSslKeyFilePropertyInfo Source #
constructServerSslKeyFile :: IsServer o => Text -> IO (GValueConstruct o) Source #
serverSslKeyFile :: AttrLabelProxy "sslKeyFile" Source #
tlsCertificate
data ServerTlsCertificatePropertyInfo Source #
constructServerTlsCertificate :: (IsServer o, IsTlsCertificate a) => a -> IO (GValueConstruct o) Source #
getServerTlsCertificate :: (MonadIO m, IsServer o) => o -> m (Maybe TlsCertificate) Source #
serverTlsCertificate :: AttrLabelProxy "tlsCertificate" Source #
Signals
requestAborted
type C_ServerRequestAbortedCallback = Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO () Source #
type ServerRequestAbortedCallback = Message -> ClientContext -> IO () Source #
afterServerRequestAborted :: (GObject a, MonadIO m) => a -> ServerRequestAbortedCallback -> m SignalHandlerId Source #
mk_ServerRequestAbortedCallback :: C_ServerRequestAbortedCallback -> IO (FunPtr C_ServerRequestAbortedCallback) Source #
onServerRequestAborted :: (GObject a, MonadIO m) => a -> ServerRequestAbortedCallback -> m SignalHandlerId Source #
wrap_ServerRequestAbortedCallback :: ServerRequestAbortedCallback -> Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO () Source #
requestFinished
type C_ServerRequestFinishedCallback = Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO () Source #
type ServerRequestFinishedCallback = Message -> ClientContext -> IO () Source #
afterServerRequestFinished :: (GObject a, MonadIO m) => a -> ServerRequestFinishedCallback -> m SignalHandlerId Source #
mk_ServerRequestFinishedCallback :: C_ServerRequestFinishedCallback -> IO (FunPtr C_ServerRequestFinishedCallback) Source #
onServerRequestFinished :: (GObject a, MonadIO m) => a -> ServerRequestFinishedCallback -> m SignalHandlerId Source #
wrap_ServerRequestFinishedCallback :: ServerRequestFinishedCallback -> Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO () Source #
requestRead
type C_ServerRequestReadCallback = Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO () Source #
type ServerRequestReadCallback = Message -> ClientContext -> IO () Source #
afterServerRequestRead :: (GObject a, MonadIO m) => a -> ServerRequestReadCallback -> m SignalHandlerId Source #
mk_ServerRequestReadCallback :: C_ServerRequestReadCallback -> IO (FunPtr C_ServerRequestReadCallback) Source #
onServerRequestRead :: (GObject a, MonadIO m) => a -> ServerRequestReadCallback -> m SignalHandlerId Source #
wrap_ServerRequestReadCallback :: ServerRequestReadCallback -> Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO () Source #
requestStarted
type C_ServerRequestStartedCallback = Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO () Source #
type ServerRequestStartedCallback = Message -> ClientContext -> IO () Source #
afterServerRequestStarted :: (GObject a, MonadIO m) => a -> ServerRequestStartedCallback -> m SignalHandlerId Source #
mk_ServerRequestStartedCallback :: C_ServerRequestStartedCallback -> IO (FunPtr C_ServerRequestStartedCallback) Source #
onServerRequestStarted :: (GObject a, MonadIO m) => a -> ServerRequestStartedCallback -> m SignalHandlerId Source #
wrap_ServerRequestStartedCallback :: ServerRequestStartedCallback -> Ptr () -> Ptr Message -> Ptr ClientContext -> Ptr () -> IO () Source #