-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | HTTP/2.0 library including HPACK
--
-- HTTP/2.0 library including HPACK. Currently only HPACK 09 is
-- supported.
@package http2
@version 0.5.0
-- | HPACK: encoding and decoding a header list.
module Network.HPACK
-- | HPACK encoding, from HeaderList to ByteStream.
type HPACKEncoding = Context -> HeaderList -> IO (Context, ByteStream)
-- | HPACK decoding, from ByteStream to HeaderList.
type HPACKDecoding = Context -> ByteStream -> IO (Context, HeaderList)
-- | Converting HeaderList for HTTP request to the low level format.
encodeHeader :: EncodeStrategy -> HPACKEncoding
-- | Converting the low level format for HTTP request to HeaderList.
-- DecodeError would be thrown.
decodeHeader :: HPACKDecoding
-- | Context for HPACK encoding/decoding. This is destructive!
data Context
-- | Creating a new Context. The first argument is the size of a
-- header table.
newContextForEncoding :: Size -> IO Context
-- | Creating a new Context. The first argument is the size of a
-- header table.
newContextForDecoding :: Size -> IO Context
-- | Compression algorithms for HPACK encoding.
data CompressionAlgo
-- | No compression
Naive :: CompressionAlgo
-- | Using the static table only
Static :: CompressionAlgo
-- | Using indices only
Linear :: CompressionAlgo
-- | Strategy for HPACK encoding.
data EncodeStrategy
EncodeStrategy :: CompressionAlgo -> Bool -> EncodeStrategy
-- | Which compression algorithm is used.
compressionAlgo :: EncodeStrategy -> CompressionAlgo
-- | Whether or not to use Huffman encoding for strings.
useHuffman :: EncodeStrategy -> Bool
-- | Default EncodeStrategy. compressionAlgo is Linear
-- and useHuffman is True.
defaultEncodeStrategy :: EncodeStrategy
-- | Errors for decoder.
data DecodeError
-- | Index is out of range
IndexOverrun :: Index -> DecodeError
-- | Eos appears in the middle of huffman string
EosInTheMiddle :: DecodeError
-- | Non-eos appears in the end of huffman string
IllegalEos :: DecodeError
-- | Eos of huffman string is more than 7 bits
TooLongEos :: DecodeError
-- | Encoded string has no length
EmptyEncodedString :: DecodeError
-- | Header block is empty
EmptyBlock :: DecodeError
-- | Header list.
type HeaderList = [Header]
-- | Header.
type Header = (HeaderName, HeaderValue)
-- | Header name.
type HeaderName = ByteString
-- | Header value.
type HeaderValue = ByteString
-- | Byte stream in HTTP request/response.
type ByteStream = ByteString
-- | Size in bytes.
type Size = Int
-- | Index for table.
type Index = Int