hpack v1.0.3 HPack

Implementation of the HPack protocol, a compression format for efficiently representing HTTP header fields, to be used in HTTP/2.

Summary

Functions

Decodes a header block fragment as specified in RFC 7541

Encodes a list of headers into a header block fragment as specified in RFC 7541

Types

header()
header() :: {String.t, String.t}
header_block_fragment()
header_block_fragment() :: binary

Functions

decode(hbf, table)

Decodes a header block fragment as specified in RFC 7541.

Returns the decoded headers as a List.

Examples

iex> {:ok, ctx} = HPack.Table.start_link(1000)
iex> HPack.decode(<< 0x82 >>, ctx)
[{":method", "GET"}]
encode(headers, table)

Encodes a list of headers into a header block fragment as specified in RFC 7541.

Returns the header block fragment.

Examples

iex> {:ok, ctx} = HPack.Table.start_link(1000)
iex> HPack.encode([{":method", "GET"}], ctx)
<< 0b10000010 >>