Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Http2Client = Http2Client {
- _ping :: ByteString -> IO (IO (FrameHeader, FramePayload))
- _settings :: SettingsList -> IO ()
- _goaway :: ErrorCodeId -> ByteString -> IO ()
- _startStream :: forall a. StreamStarter a
- _incomingFlowControl :: IncomingFlowControl
- _outgoingFlowControl :: OutgoingFlowControl
- _paylodSplitter :: IO PayloadSplitter
- newHttp2Client :: HostName -> PortNumber -> Int -> Int -> ClientParams -> SettingsList -> PushPromiseHandler a -> IO Http2Client
- type PushPromiseHandler a = StreamId -> Http2Stream -> IncomingFlowControl -> OutgoingFlowControl -> IO a
- data Http2Stream = Http2Stream {
- _headers :: HeaderList -> (FrameFlags -> FrameFlags) -> IO StreamThread
- _prio :: Priority -> IO ()
- _rst :: ErrorCodeId -> IO ()
- _waitHeaders :: IO (FrameHeader, StreamId, Either ErrorCode HeaderList)
- _waitData :: IO (FrameHeader, Either ErrorCode ByteString)
- _sendDataChunk :: (FrameFlags -> FrameFlags) -> ByteString -> IO ()
- sendData :: Http2Client -> Http2Stream -> (FrameFlags -> FrameFlags) -> ByteString -> IO ()
- data StreamThread
- _gtfo :: Http2Client -> ErrorCodeId -> ByteString -> IO ()
- data StreamDefinition a = StreamDefinition {}
- data IncomingFlowControl = IncomingFlowControl {
- _addCredit :: WindowSize -> IO ()
- _consumeCredit :: WindowSize -> IO Int
- _updateWindow :: IO Bool
- data OutgoingFlowControl = OutgoingFlowControl {
- _receiveCredit :: WindowSize -> IO ()
- _withdrawCredit :: WindowSize -> IO WindowSize
- module Network.HTTP2.Client.FrameConnection
- module Network.Socket
- module Network.TLS
Documentation
data Http2Client Source #
Record holding functions one can call while in an HTTP2 client session.
Http2Client | |
|
:: HostName | Host to connect to. |
-> PortNumber | Port number to connect to (usually 443 on the web). |
-> Int | The buffersize for the Network.HPACK encoder. |
-> Int | The buffersize for the Network.HPACK decoder. |
-> ClientParams | The TLS client parameters (e.g., to allow some certificates). |
-> SettingsList | Initial SETTINGS that are sent as first frame. |
-> PushPromiseHandler a | Action to perform when a server sends a PUSH_PROMISE. |
-> IO Http2Client |
Starts a new Http2Client with a remote Host/Port. TLS ClientParams are mandatory because we only support TLS-protected streams for now.
type PushPromiseHandler a = StreamId -> Http2Stream -> IncomingFlowControl -> OutgoingFlowControl -> IO a Source #
Handler upon receiving a PUSH_PROMISE from the server.
The functions for Http2Stream
are similar to those used in ''. But callers
shall not use _headers
to initialize the PUSH_PROMISE stream. Rather,
callers should waitHeaders
or _rst
to reject the PUSH_PROMISE.
The StreamId corresponds to the parent stream as PUSH_PROMISEs are tied to a
client-initiated stream. Longer term we may move passing this handler to the
_startStream
instead of newHttp2Client
(as it is for now).
data Http2Stream Source #
Record holding functions one can call while in an HTTP2 client stream.
Http2Stream | |
|
sendData :: Http2Client -> Http2Stream -> (FrameFlags -> FrameFlags) -> ByteString -> IO () Source #
data StreamThread Source #
Opaque proof that a client stream was initialized.
This type is only useful to force calling _headers
in _initStream
and
contains no information.
_gtfo :: Http2Client -> ErrorCodeId -> ByteString -> IO () Source #
data StreamDefinition a Source #
Defines a client stream.
Please red the doc for this record fields and then see StreamStarter
.
StreamDefinition | |
|
data IncomingFlowControl Source #
Offers credit-based flow-control.
Any mutable changes are atomic and hence work as intended in a multithreaded setup.
The design of the flow-control mechanism is subject to changes. One
important thing to keep in mind with current implementation is that both the
connection and streams are credited with _addCredit
as soon as DATA frames
arrive, hence no-need to account for the DATA frames (but you can account
for delay-bandwidth product for instance).
IncomingFlowControl | |
|
data OutgoingFlowControl Source #
Receives credit-based flow-control or block.
There is no way to observe the total amount of credit and receive/withdraw
are atomic hence this object is thread-safe. However we plan to propose an
STM-based API to allow withdrawing atomically from both the connection and a
per-stream OutgoingFlowControl
objects at a same time. Without such
atomicity one must ensure consumers do not exhaust the connection credit
before taking the per-stream credit (else they might prevent others sending
data without taking any).
Longer term we plan to hide outgoing-flow-control increment/decrement altogether because exception between withdrawing credit and sending DATA could mean lost credit (and hence hanging streams).
OutgoingFlowControl | |
|
module Network.Socket
module Network.TLS