http2-0.3.0: HTTP/2.0 library including HPACK

Safe HaskellNone

Network.HPACK

Contents

Description

HPACK: encoding and decoding a header set.

Synopsis

Encoding and decoding

encodeHeader :: EncodeStrategy -> HPACKEncodingSource

Converting HeaderSet for HTTP request to the low level format.

decodeHeader :: HPACKDecodingSource

Converting the low level format for HTTP request to HeaderSet. DecodeError would be thrown.

Contenxt

data Context Source

Context for HPACK encoding/decoding. This is destructive!

newContextForEncoding :: Size -> IO ContextSource

Creating a new Context. The first argument is the size of a header table.

newContextForDecoding :: Size -> IO ContextSource

Creating a new Context. The first argument is the size of a header table.

Strategy for encoding

data CompressionAlgo Source

Compression algorithms for HPACK encoding.

Constructors

Naive

No compression

Static

Using the static table only

Linear

Using indices only

Diff

Calculating difference

data EncodeStrategy Source

Strategy for HPACK encoding.

Constructors

EncodeStrategy 

Fields

compressionAlgo :: CompressionAlgo

Which compression algorithm is used.

useHuffman :: Bool

Whether or not to use Huffman encoding for strings.

Errors for decoding

data DecodeError Source

Errors for decoder.

Constructors

IndexOverrun Index

Index is out of range

EosInTheMiddle

Eos appears in the middle of huffman string

IllegalEos

Non-eos appears in the end of huffman string

TooLongEos

Eos of huffman string is more than 7 bits

EmptyEncodedString

Encoded string has no length

EmptyBlock

Header block is empty

Headers

type HeaderSet = [Header]Source

Header set.

type HeaderName = ByteStringSource

Header name.

type HeaderValue = ByteStringSource

Header value.

Basic types

type ByteStream = ByteStringSource

Byte stream in HTTP request/response.

type Size = IntSource

Size in bytes.

type Index = IntSource

Index for table.