HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

  • Packagehttp2-5.3.10
  • Exports32
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceHPACK.hs

Encoding and decoding

6 declarations
typetype Header = (HeaderName, ByteString)
#

A full HTTP header field with the name and value separated.

E.g. "Content-Length: 28" parsed into a Header would turn into ("Content-Length", "28")

valueoriginal :: CI s -> s
#

Retrieve the original string-like value.

valuemk :: FoldCase s => s -> CI s
#

Make the given string-like value case insensitive.

Encoding and decoding with token

2 declarations
valueencodeTokenHeader
  1. :: Buffer
  2. -> BufferSize
  3. -> EncodeStrategy
  4. -> Bool

    True at the first time, False when continued.

  5. -> DynamicTable
  6. -> TokenHeaderList
  7. -> IO (TokenHeaderList, Int)

    Leftover, filled length

#

Converting TokenHeaderList to the HPACK format directly in the buffer.

When calling this function for a new TokenHeaderList, 4th argument must be True.

The return value is a pair of leftover TokenHeaderList and how many bytes are filled in the buffer. If the leftover is empty, the encoding is finished. Otherwise, this function should be called with it again. 4th argument must be False.

4th argument is relating to dynamic table size update. If True and the limit is set by setLimitForEncoding, dynamic table size update is generated at the beginning of the HPACK format.

Converting the HPACK format 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.

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

  • BufferOverrun will be thrown if the temporary buffer for Huffman decoding is too small.

DynamicTable

7 declarations

Default dynamic table size. The value is 4,096 bytes: an array has 128 entries.

Example1 expression
defaultDynamicTableSize4096

Strategy for encoding

3 declarations

Errors

2 declarations
datadata DecodeError
#

Errors for decoder.

Constructors

Instances3Eq, Show, Exception

Token header

4 declarations

Value table

4 declarations

Basic types

4 declarations