The data type for HTTP/2 frames.
Modulehttp2-5.3.10Haskell2010
Network.HTTP2.Frame
Framing in HTTP/2(https://www.rfc-editor.org/rfc/rfc9113).
- 21 types
- 56 values
- Packagehttp2-5.3.10
- Exports107
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceFrame.hs
Frame
6 declarationsThe data type for HTTP/2 frame headers.
Constructors
Instances3Eq, Read, Show
Eq FrameHeaderDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesRead FrameHeaderDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesShow FrameHeaderDefined in http2-5.3.10 · Network.HTTP2.Frame.Types
The data type for HTTP/2 frame payloads.
Constructors
DataFrame ByteStringHeadersFrame (Maybe Priority) HeaderBlockFragmentPriorityFrame PriorityRSTStreamFrame ErrorCodeSettingsFrame SettingsListPushPromiseFrame StreamId HeaderBlockFragmentPingFrame ByteStringGoAwayFrame StreamId ErrorCode ByteStringWindowUpdateFrame WindowSizeContinuationFrame HeaderBlockFragmentUnknownFrame FrameType ByteString
Instances3Eq, Read, Show
Eq FramePayloadDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesRead FramePayloadDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesShow FramePayloadDefined in http2-5.3.10 · Network.HTTP2.Frame.Types
The type for fragments of a header encoded with HPACK.
The type for padding in payloads.
Checking if padding is defined in this frame type.
isPaddingDefined $ DataFrame ""TrueisPaddingDefined $ PingFrame ""False
Encoding
23 declarationsEncoding an HTTP/2 frame to ByteString. This function is not efficient enough for high performace program because of the concatenation of ByteString.
encodeFrame (encodeInfo id 1) (DataFrame "body")"\NUL\NUL\EOT\NUL\NUL\NUL\NUL\NUL\SOHbody"
Encoding an HTTP/2 frame to [ByteString]. This is suitable for sendMany.
Encoding an HTTP/2 frame header. The frame header must be completed.
Writing an encoded HTTP/2 frame header to the buffer. The length of the buffer must be larger than or equal to 9 bytes.
Encoding an HTTP/2 frame payload. This returns a complete frame header and chunks of payload.
Auxiliary information for frame encoding.
Constructors
EncodeInfoencodeFlags :: FrameFlagsFlags to be set in a frame header
encodeStreamId :: StreamIdStream id to be set in a frame header
encodePadding :: Maybe PaddingPadding if any. In the case where this value is set but the priority flag is not set, this value gets preference over the priority flag. So, if this value is set, the priority flag is also set.
Instances2Read, Show
Read EncodeInfoDefined in http2-5.3.10 · Network.HTTP2.Frame.EncodeShow EncodeInfoDefined in http2-5.3.10 · Network.HTTP2.Frame.Encode
A smart builder of EncodeInfo.
encodeInfo setAck 0EncodeInfo {encodeFlags = 1, encodeStreamId = 0, encodePadding = Nothing}
Decoding an HTTP/2 frame to ByteString. The second argument must be include the entire of frame. So, this function is not useful for real applications but useful for testing.
Decoding an HTTP/2 frame header. Must supply 9 bytes.
Checking a frame header and reporting an error if any.
checkFrameHeader (FrameData,(FrameHeader 100 0 0))Left (FrameDecodeError ProtocolError 0 "cannot used in control stream")
Constructors
Instances3Eq, Show, Exception
Eq FrameDecodeErrorDefined in http2-5.3.10 · Network.HTTP2.Frame.DecodeShow FrameDecodeErrorDefined in http2-5.3.10 · Network.HTTP2.Frame.DecodeException FrameDecodeErrorDefined in http2-5.3.10 · Network.HTTP2.Frame.Decode
Decoding an HTTP/2 frame payload. This function is considered to return a frame payload decoder according to a frame type.
The type for frame payload decoder.
Frame payload decoder for DATA frame.
Frame payload decoder for HEADERS frame.
Frame payload decoder for PRIORITY frame.
Frame payload decoder for RST_STREAM frame.
Frame payload decoder for SETTINGS frame.
Frame payload decoder for PUSH_PROMISE frame.
Frame payload decoder for PING frame.
Frame payload decoder for GOAWAY frame.
Frame payload decoder for WINDOW_UPDATE frame.
Frame payload decoder for CONTINUATION frame.
Frame type
16 declarationsInstances5Eq, Ord, Read, Show, Ix
Eq FrameTypeDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesOrd FrameTypeDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesRead FrameTypeDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesShow FrameTypeDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesIx FrameTypeDefined in http2-5.3.10 · Network.HTTP2.Frame.Types
Getting FrameType from FramePayload.
framePayloadToFrameType (DataFrame "body")FrameData
Priority
2 declarationsType for stream priority. Deprecated in RFC 9113 but provided for FrameHeaders.
The type for weight in priority. Its values are from 1 to 256. Deprecated in RFC 9113.
Stream identifier
4 declarationsThe type for stream identifier
Checking if the stream identifier for control.
isControl 0TrueisControl 1False
Checking if the stream identifier is from a client.
isClientInitiated 0FalseisClientInitiated 1True
Checking if the stream identifier is from a server.
isServerInitiated 0FalseisServerInitiated 2True
Stream identifier related
3 declarationsChecking if the exclusive flag is set.
Setting the exclusive flag.
Clearing the exclusive flag.
Flags
12 declarationsThe type for flags.
The initial value of flags. No flags are set.
defaultFlags0
Checking if the END_STREAM flag is set. >>> testEndStream 0x1 True
Checking if the ACK flag is set. >>> testAck 0x1 True
Checking if the END_HEADERS flag is set.
testEndHeader 0x4True
Checking if the PADDED flag is set.
testPadded 0x8True
Checking if the PRIORITY flag is set.
testPriority 0x20True
Setting the END_STREAM flag.
setEndStream 01
Setting the ACK flag.
setAck 01
Setting the END_HEADERS flag.
setEndHeader 04
Setting the PADDED flag.
setPadded 08
Setting the PRIORITY flag.
setPriority 032
SettingsList
11 declarationsAssociation list of SETTINGS.
The type for SETTINGS key.
Constructors
Instances4Eq, Ord, Read, Show
Eq SettingsKeyDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesOrd SettingsKeyDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesRead SettingsKeyDefined in http2-5.3.10 · Network.HTTP2.Frame.TypesShow SettingsKeyDefined in http2-5.3.10 · Network.HTTP2.Frame.Types
The type for raw SETTINGS value.
Payload length
2 declarationsThe default payload length of HTTP/2 payload.
defaultPayloadLength16384
The maximum payload length of HTTP/2 payload.
maxPayloadLength16777215
Window
4 declarationsWindow size.
The default initial window size.
defaultWindowSize65535
The maximum window size.
maxWindowSize2147483647
Checking if a window size exceeds the maximum window size.
isWindowOverflow 10FalseisWindowOverflow maxWindowSizeFalseisWindowOverflow (maxWindowSize + 1)True
Error code
17 declarationsThe type for error code. See https://www.rfc-editor.org/rfc/rfc9113#ErrorCodes.
Predefined values
4 declarationsThe preface of HTTP/2.
connectionPreface"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
Length of the preface.
connectionPrefaceLength24
The length of HTTP/2 frame header.
frameHeaderLength9
Default concurrency.
recommendedConcurrency100
Deprecated
3 declarationsDeprecated. Use ErrorCode instead
Deprecated. Use SettingsKey instead
Deprecated. Use FrameType instead