nhttp_qpack_static_table (nhttp_lib v1.1.1)

View Source

QPACK static table for HTTP/3 (RFC 9204 Appendix A).

This module provides the 99-entry static table used by QPACK header compression. Forward lookup by index and reverse lookup by name, or by name and value, are constant time.

Summary

Functions

Find the smallest index matching the given header name.

Find an index matching the given header name and value. Returns {ok, Index} for an exact name+value match, {name, Index} if only the name matches (smallest index), or error if the name is not found at all.

Look up a static table entry by index. Returns {ok, {Name, Value}} for valid indices 0-98, or {error, bad_index} for anything else.

Return the number of entries in the static table.

Types

index()

-type index() :: 0..98.

static_entry()

-type static_entry() :: {Name :: binary(), Value :: binary()}.

Functions

find_name(Name)

-spec find_name(binary()) -> {ok, index()} | error.

Find the smallest index matching the given header name.

Returns {ok, Index} if the name exists in the static table, or error if it does not. When multiple entries share the same name, the smallest index is returned.

find_name_value(Name, Value)

-spec find_name_value(binary(), binary()) -> {ok, index()} | {name, index()} | error.

Find an index matching the given header name and value. Returns {ok, Index} for an exact name+value match, {name, Index} if only the name matches (smallest index), or error if the name is not found at all.

lookup/1

-spec lookup(non_neg_integer()) -> {ok, static_entry()} | {error, bad_index}.

Look up a static table entry by index. Returns {ok, {Name, Value}} for valid indices 0-98, or {error, bad_index} for anything else.

size()

-spec size() -> 99.

Return the number of entries in the static table.