Module hpack

The hpack module provides functions for working with HPACK as described in RFC 7541.

References

Description

The hpack module provides functions for working with HPACK as described in RFC 7541.

Data Types

context()

context() = #hpack_context{dynamic_table = any(), connection_max_table_size = non_neg_integer()}

header()

header() = {header_name(), header_value()}

header_name()

header_name() = binary()

header_value()

header_value() = binary()

headers()

headers() = [header()]

Function Index

decode/2 Decodes the given binary into a list of headers using the given HPACK context.
encode/2 Encodes the given Headers using the given Context.
new_context/0Equivalent to new_context(4096).
new_context/1 Returns a new HPACK context with the given MaxTableSize as the max table size.
new_max_table_size/2 Updates the max table size of the given HPACK context (Context) to the given NewSize.

Function Details

decode/2

decode(Bin::binary(), Context::context()) -> {ok, {headers(), context()}} | {error, compression_error} | {error, {compression_error, {bad_header_packet, binary()}}}

Decodes the given binary into a list of headers using the given HPACK context.

If successful, returns a {ok, {Headers, NewContext}} tuple where Headers are the decoded headers and NewContext is the new HPACK context.

For example:
  {Headers, NewContext} = hpack:decode(Binary, OldContext).

encode/2

encode(Headers::headers(), Context::context()) -> {ok, {binary(), context()}} | {error, term()}

Encodes the given Headers using the given Context.

When successful, returns a {ok, {EncodedHeaders, NewContext}} tuple where EncodedHeaders is a binary representing the encoded headers and NewContext is the new HPACK context.

For example:
  Headers = [{<<":method">>, <<"GET">>}],
  {ok, {EncodedHeaders, NewContext}} = hpack:encode(Headers, hpack:new_context()).

new_context/0

new_context() -> context()

Equivalent to new_context(4096).

new_context/1

new_context(MaxTableSize::non_neg_integer()) -> context()

Returns a new HPACK context with the given MaxTableSize as the max table size.

new_max_table_size/2

new_max_table_size(NewSize::non_neg_integer(), Hpack_context::context()) -> context()

Updates the max table size of the given HPACK context (Context) to the given NewSize.

Useful when HTTP/2 settings are renegotiated.


Generated by EDoc, Jan 15 2017, 13:02:32.