| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Network.HTTP2.TLS.Server
Synopsis
- run :: Settings -> Credentials -> HostName -> PortNumber -> Server -> IO ()
- runH2C :: Settings -> HostName -> PortNumber -> Server -> IO ()
- type Server = Request -> Aux -> (Response -> [PushPromise] -> IO ()) -> IO ()
- type HostName = String
- data PortNumber
- runTLS :: Settings -> Credentials -> HostName -> PortNumber -> ByteString -> (Manager -> IOBackend -> IO a) -> IO a
- data Settings
- defaultSettings :: Settings
- settingsTimeout :: Settings -> Int
- settingsSendBufferSize :: Settings -> Int
- settingsSlowlorisSize :: Settings -> Int
- settingsReadBufferSize :: Settings -> Int
- settingsReadBufferLowerLimit :: Settings -> Int
- settingsKeyLogger :: Settings -> String -> IO ()
- settingsNumberOfWorkers :: Settings -> Int
- settingsConcurrentStreams :: Settings -> Int
- settingsConnectionWindowSize :: Settings -> Int
- settingsStreamWindowSize :: Settings -> Int
- settingsSessionManager :: Settings -> SessionManager
- settingsOpenServerSocket :: Settings -> AddrInfo -> IO Socket
- data IOBackend
- send :: IOBackend -> ByteString -> IO ()
- sendMany :: IOBackend -> [ByteString] -> IO ()
- recv :: IOBackend -> IO ByteString
- mySockAddr :: IOBackend -> SockAddr
- peerSockAddr :: IOBackend -> SockAddr
- runIO :: Settings -> Credentials -> HostName -> PortNumber -> (ServerIO -> IO (IO ())) -> IO ()
- runIOH2C :: Settings -> HostName -> PortNumber -> (ServerIO -> IO (IO ())) -> IO ()
- data Stream
- data ServerIO = ServerIO {
- sioMySockAddr :: SockAddr
- sioPeerSockAddr :: SockAddr
- sioReadRequest :: IO (StreamId, Stream, Request)
- sioWriteResponse :: Stream -> Response -> IO ()
- sioWriteBytes :: ByteString -> IO ()
Runners
run :: Settings -> Credentials -> HostName -> PortNumber -> Server -> IO () Source #
Running an HTTP/2 client over TLS (over TCP). ALPN is "h2".
runH2C :: Settings -> HostName -> PortNumber -> Server -> IO () Source #
Running an HTTP/2 client over TCP.
type Server = Request -> Aux -> (Response -> [PushPromise] -> IO ()) -> IO () #
Server type. Server takes a HTTP request, should generate a HTTP response and push promises, then should give them to the sending function. The sending function would throw exceptions so that they can be logged.
Either a host name e.g., "haskell.org" or a numeric host
address string consisting of a dotted decimal IPv4 address or an
IPv6 address e.g., "192.168.0.1".
data PortNumber #
Port number.
Use the Num instance (i.e. use a literal) to create a
PortNumber value.
>>>1 :: PortNumber1>>>read "1" :: PortNumber1>>>show (12345 :: PortNumber)"12345">>>50000 < (51000 :: PortNumber)True>>>50000 < (52000 :: PortNumber)True>>>50000 + (10000 :: PortNumber)60000
Instances
Arguments
| :: Settings | |
| -> Credentials | |
| -> HostName | |
| -> PortNumber | |
| -> ByteString | ALPN |
| -> (Manager -> IOBackend -> IO a) | |
| -> IO a |
Settings
defaultSettings :: Settings Source #
Default settings.
settingsTimeout :: Settings -> Int Source #
Timeout in seconds. (All)
>>>settingsTimeout defaultSettings30
settingsSendBufferSize :: Settings -> Int Source #
Send buffer size. (H2 and H2c)
>>>settingsSendBufferSize defaultSettings4096
settingsSlowlorisSize :: Settings -> Int Source #
If the size of receiving data is less than or equal, the timeout is not reset. (All)
>>>settingsSlowlorisSize defaultSettings50
settingsReadBufferSize :: Settings -> Int Source #
When the size of a read buffer is lower than this limit, the buffer is thrown awany (and is eventually freed). Then a new buffer is allocated. (All)
>>>settingsReadBufferSize defaultSettings16384
settingsReadBufferLowerLimit :: Settings -> Int Source #
The allocation size for a read buffer. (All)
>>>settingsReadBufferLowerLimit defaultSettings2048
settingsKeyLogger :: Settings -> String -> IO () Source #
Key logger (defaults to none)
Applications may wish to set this depending on the SSLKEYLOGFILE environment variable. The default is do nothing.
settingsNumberOfWorkers :: Settings -> Int Source #
The number of workers (H2 and H2c)
>>>settingsNumberOfWorkers defaultSettings8
settingsConcurrentStreams :: Settings -> Int Source #
The maximum number of incoming streams on the net (H2 and H2c)
>>>settingsConcurrentStreams defaultSettings64
settingsConnectionWindowSize :: Settings -> Int Source #
The window size of a connection (H2 and H2c)
>>>settingsConnectionWindowSize defaultSettings1048575
settingsStreamWindowSize :: Settings -> Int Source #
The window size of incoming streams (H2 and H2c)
>>>settingsStreamWindowSize defaultSettings262144
settingsSessionManager :: Settings -> SessionManager Source #
TLS session manager (H2 and TLS)
settingsOpenServerSocket :: Settings -> AddrInfo -> IO Socket Source #
Function to initialize the server socket
Defaults to openServerSocket
IO backend
Sending and receiving functions.
Tiemout is reset when they return.
One exception is the slowloris attach prevention.
See settingsSlowlorisSize.
mySockAddr :: IOBackend -> SockAddr Source #
peerSockAddr :: IOBackend -> SockAddr Source #
Internal
runIO :: Settings -> Credentials -> HostName -> PortNumber -> (ServerIO -> IO (IO ())) -> IO () Source #
Constructors
| ServerIO | |
Fields
| |