HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Modulehttp2-5.4.8Haskell2010

Network.HPACK.Internal

  • 8 types
  • 26 values
  • Packagehttp2-5.4.8
  • Exports34
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInteger.hs

Integer encoding/decoding

5 declarations
valuedecodeI
  1. :: Int

    N+

  2. -> Word8

    The head of encoded integer whose prefix is already dropped

  3. -> ReadBuffer
  4. -> IO Int
#

Integer decoding with a read buffer. The first argument is N of prefix.

valuedecodeInteger
  1. :: Int

    N+

  2. -> Word8

    The head of encoded integer whose prefix is already dropped

  3. -> ByteString

    The tail of encoded integer

  4. -> IO Int
#

Integer decoding. The first argument is N of prefix.

Example3 expressions
decodeInteger 5 10 $ BS.empty10decodeInteger 5 31 $ BS.pack [154,10]1337decodeInteger 8 42 $ BS.empty42
valueencodeInteger
  1. :: Int

    N+

  2. -> Int

    Target

  3. -> IO ByteString
#

Encoding integer with a temporary buffer whose size is 4096. No prefix is set.

Example3 expressions
BS.unpack <$> encodeInteger 5 10[10]BS.unpack <$> encodeInteger 5 1337[31,154,10]BS.unpack <$> encodeInteger 8 42[42]
valueintegerLimit :: Int
#

The largest integer decodeI will return.

HPACK's integer encoding carries no bound of its own, so a decoder has to impose one. RFC 7541, section 5.1: "Integer encodings that exceed implementation limits -- in value or octet length -- MUST be treated as decoding errors."

2^30 - 1 is far above anything HTTP/2 can ask for -- a frame payload is at most 2^24 - 1 octets, so no length or index comes near it -- and it still fits in an Int on a platform where that is 32 bits wide.

Example1 expression
integerLimit1073741823

String encoding/decoding

27 declarations

Converting to TokenHeaderList and ValueTable.

  • Multiple values of Cookie: are concatenated.

  • If a pseudo header appears multiple times, IllegalHeaderName is thrown.

  • If unknown pseudo headers appear, IllegalHeaderName is thrown.

  • If pseudo headers are found after normal headers, IllegalHeaderName is thrown.

  • If a header key contains capital letters, IllegalHeaderName is thrown.

  • If the number of header fields is too large, TooLargeHeader is thrown

  • IllegalHeaderName and TooLargeHeader are thrown only once the whole block has been decoded, so that the dynamic table is up to date: the message is malformed, not the block.

  • DecodeError would be thrown if the HPACK format is broken.

datadata Entry
#

Type for table entry. Size includes the 32 bytes magic number.

Instances1Show
  • Show EntryDefined in http2-5.4.8 · Network.HPACK.Table.Entry

Types

2 declarations