http2-5.3.10: HTTP/2 library

Safe Haskell | None
Language | Haskell2010

Network.HTTP2.Frame

Contents

- Frame
- Encoding
- Frame type
- Priority
- Stream identifier
- Stream identifier related
- Flags
- SettingsList
- Payload length
- Window
- Error code
- Predefined values
- Deprecated

Description

Framing in HTTP/2(https://www.rfc-editor.org/rfc/rfc9113).

Synopsis

- data Frame = Frame {
  - frameHeader :: FrameHeader
  - framePayload :: FramePayload
  }
- data FrameHeader = FrameHeader {
  - payloadLength :: Int
  - flags :: FrameFlags
  - streamId :: StreamId
  }
- data FramePayload
  - = DataFrame ByteString
  - | HeadersFrame (Maybe Priority) HeaderBlockFragment
  - | PriorityFrame Priority
  - | RSTStreamFrame ErrorCode
  - | SettingsFrame SettingsList
  - | PushPromiseFrame StreamId HeaderBlockFragment
  - | PingFrame ByteString
  - | GoAwayFrame StreamId ErrorCode ByteString
  - | WindowUpdateFrame WindowSize
  - | ContinuationFrame HeaderBlockFragment
  - | UnknownFrame FrameType ByteString
- type HeaderBlockFragment = ByteString
- type Padding = ByteString
- isPaddingDefined :: FramePayload -> Bool
- encodeFrame :: EncodeInfo -> FramePayload -> ByteString
- encodeFrameChunks :: EncodeInfo -> FramePayload -> [ByteString]
- encodeFrameHeader :: FrameType -> FrameHeader -> ByteString
- encodeFrameHeaderBuf :: FrameType -> FrameHeader -> Ptr Word8 -> IO ()
- encodeFramePayload :: EncodeInfo -> FramePayload -> (FrameHeader, [ByteString])
- data EncodeInfo = EncodeInfo {
  - encodeFlags :: FrameFlags
  - encodeStreamId :: StreamId
  - encodePadding :: Maybe Padding
  }
- encodeInfo :: (FrameFlags -> FrameFlags) -> Int -> EncodeInfo
- decodeFrame :: ByteString -> Either FrameDecodeError Frame
- decodeFrameHeader :: ByteString -> (FrameType, FrameHeader)
- checkFrameHeader :: (FrameType, FrameHeader) -> Either FrameDecodeError (FrameType, FrameHeader)
- data FrameDecodeError = FrameDecodeError ErrorCode StreamId ShortByteString
- decodeFramePayload :: FrameType -> FramePayloadDecoder
- type FramePayloadDecoder = FrameHeader -> ByteString -> Either FrameDecodeError FramePayload
- decodeDataFrame :: FramePayloadDecoder
- decodeHeadersFrame :: FramePayloadDecoder
- decodePriorityFrame :: FramePayloadDecoder
- decodeRSTStreamFrame :: FramePayloadDecoder
- decodeSettingsFrame :: FramePayloadDecoder
- decodePushPromiseFrame :: FramePayloadDecoder
- decodePingFrame :: FramePayloadDecoder
- decodeGoAwayFrame :: FramePayloadDecoder
- decodeWindowUpdateFrame :: FramePayloadDecoder
- decodeContinuationFrame :: FramePayloadDecoder
- newtype FrameType where
  - FrameType Word8
  - pattern FrameData :: FrameType
  - pattern FrameHeaders :: FrameType
  - pattern FramePriority :: FrameType
  - pattern FrameRSTStream :: FrameType
  - pattern FrameSettings :: FrameType
  - pattern FramePushPromise :: FrameType
  - pattern FramePing :: FrameType
  - pattern FrameGoAway :: FrameType
  - pattern FrameWindowUpdate :: FrameType
  - pattern FrameContinuation :: FrameType
- fromFrameType :: FrameType -> Word8
- toFrameType :: Word8 -> FrameType
- minFrameType :: FrameType
- maxFrameType :: FrameType
- framePayloadToFrameType :: FramePayload -> FrameType
- data Priority = Priority {
  - exclusive :: Bool
  - streamDependency :: StreamId
  - weight :: Weight
  }
- type Weight = Int
- type StreamId = Int
- isControl :: StreamId -> Bool
- isClientInitiated :: StreamId -> Bool
- isServerInitiated :: StreamId -> Bool
- testExclusive :: StreamId -> Bool
- setExclusive :: StreamId -> StreamId
- clearExclusive :: StreamId -> StreamId
- type FrameFlags = Word8
- defaultFlags :: FrameFlags
- testEndStream :: FrameFlags -> Bool
- testAck :: FrameFlags -> Bool
- testEndHeader :: FrameFlags -> Bool
- testPadded :: FrameFlags -> Bool
- testPriority :: FrameFlags -> Bool
- setEndStream :: FrameFlags -> FrameFlags
- setAck :: FrameFlags -> FrameFlags
- setEndHeader :: FrameFlags -> FrameFlags
- setPadded :: FrameFlags -> FrameFlags
- setPriority :: FrameFlags -> FrameFlags
- type SettingsList = [(SettingsKey, SettingsValue)]
- newtype SettingsKey where
  - SettingsKey Word16
  - pattern SettingsTokenHeaderTableSize :: SettingsKey
  - pattern SettingsEnablePush :: SettingsKey
  - pattern SettingsMaxConcurrentStreams :: SettingsKey
  - pattern SettingsInitialWindowSize :: SettingsKey
  - pattern SettingsMaxFrameSize :: SettingsKey
  - pattern SettingsMaxHeaderListSize :: SettingsKey
- type SettingsValue = Int
- fromSettingsKey :: SettingsKey -> Word16
- toSettingsKey :: Word16 -> SettingsKey
- defaultPayloadLength :: Int
- maxPayloadLength :: Int
- type WindowSize = Int
- defaultWindowSize :: WindowSize
- maxWindowSize :: WindowSize
- isWindowOverflow :: WindowSize -> Bool
- newtype ErrorCode where
  - ErrorCode Word32
  - pattern NoError :: ErrorCode
  - pattern ProtocolError :: ErrorCode
  - pattern InternalError :: ErrorCode
  - pattern FlowControlError :: ErrorCode
  - pattern SettingsTimeout :: ErrorCode
  - pattern StreamClosed :: ErrorCode
  - pattern FrameSizeError :: ErrorCode
  - pattern RefusedStream :: ErrorCode
  - pattern Cancel :: ErrorCode
  - pattern CompressionError :: ErrorCode
  - pattern ConnectError :: ErrorCode
  - pattern EnhanceYourCalm :: ErrorCode
  - pattern InadequateSecurity :: ErrorCode
  - pattern HTTP11Required :: ErrorCode
- fromErrorCode :: ErrorCode -> Word32
- toErrorCode :: Word32 -> ErrorCode
- connectionPreface :: ByteString
- connectionPrefaceLength :: Int
- frameHeaderLength :: Int
- recommendedConcurrency :: Int
- type ErrorCodeId = ErrorCode
- type SettingsKeyId = SettingsKey
- type FrameTypeId = FrameType

# Frame

data Frame Source #

The data type for HTTP/2 frames.

Constructors

Frame |

Fields

- frameHeader :: FrameHeader
- framePayload :: FramePayload

#### Instances

Instances details

Read Frame Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods readsPrec :: Int -> ReadS Frame Source # readList :: ReadS [Frame] Source # readPrec :: ReadPrec Frame Source # readListPrec :: ReadPrec [Frame] Source #
Show Frame Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods showsPrec :: Int -> Frame -> ShowS Source # show :: Frame -> String Source # showList :: [Frame] -> ShowS Source #
Eq Frame Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods (==) :: Frame -> Frame -> Bool Source # (/=) :: Frame -> Frame -> Bool Source #

data FrameHeader Source #

The data type for HTTP/2 frame headers.

Constructors

FrameHeader |

Fields

- payloadLength :: Int
- flags :: FrameFlags
- streamId :: StreamId

#### Instances

Instances details

Read FrameHeader Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods readsPrec :: Int -> ReadS FrameHeader Source # readList :: ReadS [FrameHeader] Source # readPrec :: ReadPrec FrameHeader Source # readListPrec :: ReadPrec [FrameHeader] Source #
Show FrameHeader Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods showsPrec :: Int -> FrameHeader -> ShowS Source # show :: FrameHeader -> String Source # showList :: [FrameHeader] -> ShowS Source #
Eq FrameHeader Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods (==) :: FrameHeader -> FrameHeader -> Bool Source # (/=) :: FrameHeader -> FrameHeader -> Bool Source #

data FramePayload Source #

The data type for HTTP/2 frame payloads.

Constructors

DataFrame ByteString |
HeadersFrame (Maybe Priority) HeaderBlockFragment |
PriorityFrame Priority |
RSTStreamFrame ErrorCode |
SettingsFrame SettingsList |
PushPromiseFrame StreamId HeaderBlockFragment |
PingFrame ByteString |
GoAwayFrame StreamId ErrorCode ByteString |
WindowUpdateFrame WindowSize |
ContinuationFrame HeaderBlockFragment |
UnknownFrame FrameType ByteString |

#### Instances

Instances details

Read FramePayload Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods readsPrec :: Int -> ReadS FramePayload Source # readList :: ReadS [FramePayload] Source # readPrec :: ReadPrec FramePayload Source # readListPrec :: ReadPrec [FramePayload] Source #
Show FramePayload Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods showsPrec :: Int -> FramePayload -> ShowS Source # show :: FramePayload -> String Source # showList :: [FramePayload] -> ShowS Source #
Eq FramePayload Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods (==) :: FramePayload -> FramePayload -> Bool Source # (/=) :: FramePayload -> FramePayload -> Bool Source #

type HeaderBlockFragment = ByteString Source #

The type for fragments of a header encoded with HPACK.

type Padding = ByteString Source #

The type for padding in payloads.

isPaddingDefined :: FramePayload -> Bool Source #

Checking if padding is defined in this frame type.

    >>> isPaddingDefined $ DataFrame ""
    True
    >>> isPaddingDefined $ PingFrame ""
    False

# Encoding

encodeFrame :: EncodeInfo -> FramePayload -> ByteString Source #

Encoding 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"

encodeFrameChunks :: EncodeInfo -> FramePayload -> [ByteString] Source #

Encoding an HTTP/2 frame to [`ByteString`]. This is suitable for sendMany.

encodeFrameHeader :: FrameType -> FrameHeader -> ByteString Source #

Encoding an HTTP/2 frame header. The frame header must be completed.

encodeFrameHeaderBuf :: FrameType -> FrameHeader -> Ptr Word8 -> IO () Source #

Writing an encoded HTTP/2 frame header to the buffer. The length of the buffer must be larger than or equal to 9 bytes.

encodeFramePayload :: EncodeInfo -> FramePayload -> (FrameHeader, [ByteString]) Source #

Encoding an HTTP/2 frame payload. This returns a complete frame header and chunks of payload.

data EncodeInfo Source #

Auxiliary information for frame encoding.

Constructors

EncodeInfo |

Fields

- encodeFlags :: FrameFlags

  Flags to be set in a frame header

- encodeStreamId :: StreamId

  Stream id to be set in a frame header

- encodePadding :: Maybe Padding

  Padding 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.

#### Instances

Instances details

Read EncodeInfo Source # |
Instance details Defined in Network.HTTP2.Frame.Encode Methods readsPrec :: Int -> ReadS EncodeInfo Source # readList :: ReadS [EncodeInfo] Source # readPrec :: ReadPrec EncodeInfo Source # readListPrec :: ReadPrec [EncodeInfo] Source #
Show EncodeInfo Source # |
Instance details Defined in Network.HTTP2.Frame.Encode Methods showsPrec :: Int -> EncodeInfo -> ShowS Source # show :: EncodeInfo -> String Source # showList :: [EncodeInfo] -> ShowS Source #

encodeInfo Source #

Arguments

:: (FrameFlags -> FrameFlags) |
-> Int | stream identifier
-> EncodeInfo |

A smart builder of `EncodeInfo`.

    >>> encodeInfo setAck 0
    EncodeInfo {encodeFlags = 1, encodeStreamId = 0, encodePadding = Nothing}

decodeFrame Source #

Arguments

:: ByteString | Input byte-stream
-> Either FrameDecodeError Frame | Decoded frame

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.

decodeFrameHeader :: ByteString -> (FrameType, FrameHeader) Source #

Decoding an HTTP/2 frame header. Must supply 9 bytes.

checkFrameHeader :: (FrameType, FrameHeader) -> Either FrameDecodeError (FrameType, FrameHeader) Source #

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")

data FrameDecodeError Source #

Constructors

FrameDecodeError ErrorCode StreamId ShortByteString |

#### Instances

Instances details

Exception FrameDecodeError Source # |
Instance details Defined in Network.HTTP2.Frame.Decode Methods toException :: FrameDecodeError -> SomeException Source # fromException :: SomeException -> Maybe FrameDecodeError Source # displayException :: FrameDecodeError -> String Source # backtraceDesired :: FrameDecodeError -> Bool Source #
Show FrameDecodeError Source # |
Instance details Defined in Network.HTTP2.Frame.Decode Methods showsPrec :: Int -> FrameDecodeError -> ShowS Source # show :: FrameDecodeError -> String Source # showList :: [FrameDecodeError] -> ShowS Source #
Eq FrameDecodeError Source # |
Instance details Defined in Network.HTTP2.Frame.Decode Methods (==) :: FrameDecodeError -> FrameDecodeError -> Bool Source # (/=) :: FrameDecodeError -> FrameDecodeError -> Bool Source #

decodeFramePayload :: FrameType -> FramePayloadDecoder Source #

Decoding an HTTP/2 frame payload. This function is considered to return a frame payload decoder according to a frame type.

type FramePayloadDecoder = FrameHeader -> ByteString -> Either FrameDecodeError FramePayload Source #

The type for frame payload decoder.

decodeDataFrame :: FramePayloadDecoder Source #

Frame payload decoder for DATA frame.

decodeHeadersFrame :: FramePayloadDecoder Source #

Frame payload decoder for HEADERS frame.

decodePriorityFrame :: FramePayloadDecoder Source #

Frame payload decoder for PRIORITY frame.

decodeRSTStreamFrame :: FramePayloadDecoder Source #

Frame payload decoder for RST_STREAM frame.

decodeSettingsFrame :: FramePayloadDecoder Source #

Frame payload decoder for SETTINGS frame.

decodePushPromiseFrame :: FramePayloadDecoder Source #

Frame payload decoder for PUSH_PROMISE frame.

decodePingFrame :: FramePayloadDecoder Source #

Frame payload decoder for PING frame.

decodeGoAwayFrame :: FramePayloadDecoder Source #

Frame payload decoder for GOAWAY frame.

decodeWindowUpdateFrame :: FramePayloadDecoder Source #

Frame payload decoder for WINDOW_UPDATE frame.

decodeContinuationFrame :: FramePayloadDecoder Source #

Frame payload decoder for CONTINUATION frame.

# Frame type

newtype FrameType Source #

The type for raw frame type.

Constructors

FrameType Word8 |

Bundled Patterns

pattern FrameData :: FrameType |
pattern FrameHeaders :: FrameType |
pattern FramePriority :: FrameType |
pattern FrameRSTStream :: FrameType |
pattern FrameSettings :: FrameType |
pattern FramePushPromise :: FrameType |
pattern FramePing :: FrameType |
pattern FrameGoAway :: FrameType |
pattern FrameWindowUpdate :: FrameType |
pattern FrameContinuation :: FrameType |

#### Instances

Instances details

Ix FrameType Source # |

Instance details

Defined in Network.HTTP2.Frame.Types

Methods

range :: (FrameType, FrameType) -> [FrameType] Source #

index :: (FrameType, FrameType) -> FrameType -> Int Source #

unsafeIndex :: (FrameType, FrameType) -> FrameType -> Int Source #

inRange :: (FrameType, FrameType) -> FrameType -> Bool Source #

rangeSize :: (FrameType, FrameType) -> Int Source #

unsafeRangeSize :: (FrameType, FrameType) -> Int Source #

Read FrameType Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods readsPrec :: Int -> ReadS FrameType Source # readList :: ReadS [FrameType] Source # readPrec :: ReadPrec FrameType Source # readListPrec :: ReadPrec [FrameType] Source #
Show FrameType Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods showsPrec :: Int -> FrameType -> ShowS Source # show :: FrameType -> String Source # showList :: [FrameType] -> ShowS Source #
Eq FrameType Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods (==) :: FrameType -> FrameType -> Bool Source # (/=) :: FrameType -> FrameType -> Bool Source #
Ord FrameType Source # |

Instance details

Defined in Network.HTTP2.Frame.Types

Methods

compare :: FrameType -> FrameType -> Ordering Source #

(<) :: FrameType -> FrameType -> Bool Source #

(<=) :: FrameType -> FrameType -> Bool Source #

(>) :: FrameType -> FrameType -> Bool Source #

(>=) :: FrameType -> FrameType -> Bool Source #

max :: FrameType -> FrameType -> FrameType Source #

min :: FrameType -> FrameType -> FrameType Source #

fromFrameType :: FrameType -> Word8 Source #

Converting `FrameType` to `Word8`.

    >>> fromFrameType FrameData
    0
    >>> fromFrameType FrameContinuation
    9

toFrameType :: Word8 -> FrameType Source #

minFrameType :: FrameType Source #

maxFrameType :: FrameType Source #

framePayloadToFrameType :: FramePayload -> FrameType Source #

Getting `FrameType` from `FramePayload`.

    >>> framePayloadToFrameType (DataFrame "body")
    FrameData

# Priority

data Priority Source #

Type for stream priority. Deprecated in RFC 9113 but provided for `FrameHeaders`.

Constructors

Priority |

Fields

- exclusive :: Bool
- streamDependency :: StreamId
- weight :: Weight

#### Instances

Instances details

Read Priority Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods readsPrec :: Int -> ReadS Priority Source # readList :: ReadS [Priority] Source # readPrec :: ReadPrec Priority Source # readListPrec :: ReadPrec [Priority] Source #
Show Priority Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods showsPrec :: Int -> Priority -> ShowS Source # show :: Priority -> String Source # showList :: [Priority] -> ShowS Source #
Eq Priority Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods (==) :: Priority -> Priority -> Bool Source # (/=) :: Priority -> Priority -> Bool Source #

type Weight = Int Source #

The type for weight in priority. Its values are from 1 to 256. Deprecated in RFC 9113.

# Stream identifier

type StreamId = Int Source #

The type for stream identifier

isControl :: StreamId -> Bool Source #

Checking if the stream identifier for control.

    >>> isControl 0
    True
    >>> isControl 1
    False

isClientInitiated :: StreamId -> Bool Source #

Checking if the stream identifier is from a client.

    >>> isClientInitiated 0
    False
    >>> isClientInitiated 1
    True

isServerInitiated :: StreamId -> Bool Source #

Checking if the stream identifier is from a server.

    >>> isServerInitiated 0
    False
    >>> isServerInitiated 2
    True

# Stream identifier related

testExclusive :: StreamId -> Bool Source #

Checking if the exclusive flag is set.

setExclusive :: StreamId -> StreamId Source #

Setting the exclusive flag.

clearExclusive :: StreamId -> StreamId Source #

Clearing the exclusive flag.

# Flags

type FrameFlags = Word8 Source #

The type for flags.

defaultFlags :: FrameFlags Source #

The initial value of flags. No flags are set.

    >>> defaultFlags
    0

testEndStream :: FrameFlags -> Bool Source #

Checking if the END_STREAM flag is set. >>> testEndStream 0x1 True

testAck :: FrameFlags -> Bool Source #

Checking if the ACK flag is set. >>> testAck 0x1 True

testEndHeader :: FrameFlags -> Bool Source #

Checking if the END_HEADERS flag is set.

    >>> testEndHeader 0x4
    True

testPadded :: FrameFlags -> Bool Source #

Checking if the PADDED flag is set.

    >>> testPadded 0x8
    True

testPriority :: FrameFlags -> Bool Source #

Checking if the PRIORITY flag is set.

    >>> testPriority 0x20
    True

setEndStream :: FrameFlags -> FrameFlags Source #

Setting the END_STREAM flag.

    >>> setEndStream 0
    1

setAck :: FrameFlags -> FrameFlags Source #

Setting the ACK flag.

    >>> setAck 0
    1

setEndHeader :: FrameFlags -> FrameFlags Source #

Setting the END_HEADERS flag.

    >>> setEndHeader 0
    4

setPadded :: FrameFlags -> FrameFlags Source #

Setting the PADDED flag.

    >>> setPadded 0
    8

setPriority :: FrameFlags -> FrameFlags Source #

Setting the PRIORITY flag.

    >>> setPriority 0
    32

# SettingsList

type SettingsList = [(SettingsKey, SettingsValue)] Source #

Association list of SETTINGS.

newtype SettingsKey Source #

The type for SETTINGS key.

Constructors

SettingsKey Word16 |

Bundled Patterns

pattern SettingsTokenHeaderTableSize :: SettingsKey |
pattern SettingsEnablePush :: SettingsKey |
pattern SettingsMaxConcurrentStreams :: SettingsKey |
pattern SettingsInitialWindowSize :: SettingsKey |
pattern SettingsMaxFrameSize :: SettingsKey |
pattern SettingsMaxHeaderListSize :: SettingsKey |

#### Instances

Instances details

Read SettingsKey Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods readsPrec :: Int -> ReadS SettingsKey Source # readList :: ReadS [SettingsKey] Source # readPrec :: ReadPrec SettingsKey Source # readListPrec :: ReadPrec [SettingsKey] Source #
Show SettingsKey Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods showsPrec :: Int -> SettingsKey -> ShowS Source # show :: SettingsKey -> String Source # showList :: [SettingsKey] -> ShowS Source #
Eq SettingsKey Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods (==) :: SettingsKey -> SettingsKey -> Bool Source # (/=) :: SettingsKey -> SettingsKey -> Bool Source #
Ord SettingsKey Source # |

Instance details

Defined in Network.HTTP2.Frame.Types

Methods

compare :: SettingsKey -> SettingsKey -> Ordering Source #

(<) :: SettingsKey -> SettingsKey -> Bool Source #

(<=) :: SettingsKey -> SettingsKey -> Bool Source #

(>) :: SettingsKey -> SettingsKey -> Bool Source #

(>=) :: SettingsKey -> SettingsKey -> Bool Source #

max :: SettingsKey -> SettingsKey -> SettingsKey Source #

min :: SettingsKey -> SettingsKey -> SettingsKey Source #

type SettingsValue = Int Source #

The type for raw SETTINGS value.

fromSettingsKey :: SettingsKey -> Word16 Source #

toSettingsKey :: Word16 -> SettingsKey Source #

# Payload length

defaultPayloadLength :: Int Source #

The default payload length of HTTP/2 payload.

    >>> defaultPayloadLength
    16384

maxPayloadLength :: Int Source #

The maximum payload length of HTTP/2 payload.

    >>> maxPayloadLength
    16777215

# Window

type WindowSize = Int Source #

Window size.

defaultWindowSize :: WindowSize Source #

The default initial window size.

    >>> defaultWindowSize
    65535

maxWindowSize :: WindowSize Source #

The maximum window size.

    >>> maxWindowSize
    2147483647

isWindowOverflow :: WindowSize -> Bool Source #

Checking if a window size exceeds the maximum window size.

    >>> isWindowOverflow 10
    False
    >>> isWindowOverflow maxWindowSize
    False
    >>> isWindowOverflow (maxWindowSize + 1)
    True

# Error code

newtype ErrorCode Source #

The type for raw error code.

Constructors

ErrorCode Word32 |

Bundled Patterns

pattern NoError :: ErrorCode | The type for error code. See https://www.rfc-editor.org/rfc/rfc9113#ErrorCodes.
pattern ProtocolError :: ErrorCode |
pattern InternalError :: ErrorCode |
pattern FlowControlError :: ErrorCode |
pattern SettingsTimeout :: ErrorCode |
pattern StreamClosed :: ErrorCode |
pattern FrameSizeError :: ErrorCode |
pattern RefusedStream :: ErrorCode |
pattern Cancel :: ErrorCode |
pattern CompressionError :: ErrorCode |
pattern ConnectError :: ErrorCode |
pattern EnhanceYourCalm :: ErrorCode |
pattern InadequateSecurity :: ErrorCode |
pattern HTTP11Required :: ErrorCode |

#### Instances

Instances details

Read ErrorCode Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods readsPrec :: Int -> ReadS ErrorCode Source # readList :: ReadS [ErrorCode] Source # readPrec :: ReadPrec ErrorCode Source # readListPrec :: ReadPrec [ErrorCode] Source #
Show ErrorCode Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods showsPrec :: Int -> ErrorCode -> ShowS Source # show :: ErrorCode -> String Source # showList :: [ErrorCode] -> ShowS Source #
Eq ErrorCode Source # |
Instance details Defined in Network.HTTP2.Frame.Types Methods (==) :: ErrorCode -> ErrorCode -> Bool Source # (/=) :: ErrorCode -> ErrorCode -> Bool Source #
Ord ErrorCode Source # |

Instance details

Defined in Network.HTTP2.Frame.Types

Methods

compare :: ErrorCode -> ErrorCode -> Ordering Source #

(<) :: ErrorCode -> ErrorCode -> Bool Source #

(<=) :: ErrorCode -> ErrorCode -> Bool Source #

(>) :: ErrorCode -> ErrorCode -> Bool Source #

(>=) :: ErrorCode -> ErrorCode -> Bool Source #

max :: ErrorCode -> ErrorCode -> ErrorCode Source #

min :: ErrorCode -> ErrorCode -> ErrorCode Source #

fromErrorCode :: ErrorCode -> Word32 Source #

toErrorCode :: Word32 -> ErrorCode Source #

# Predefined values

connectionPreface :: ByteString Source #

The preface of HTTP/2.

    >>> connectionPreface
    "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"

connectionPrefaceLength :: Int Source #

Length of the preface.

    >>> connectionPrefaceLength
    24

frameHeaderLength :: Int Source #

The length of HTTP/2 frame header.

    >>> frameHeaderLength
    9

recommendedConcurrency :: Int Source #

Default concurrency.

    >>> recommendedConcurrency
    100

# Deprecated

type ErrorCodeId = ErrorCode Source #

Deprecated: Use ErrorCode instead

type SettingsKeyId = SettingsKey Source #

Deprecated: Use SettingsKey instead

type FrameTypeId = FrameType Source #

Deprecated: Use FrameType instead