Skip to content

HpackEncoder

Defined in: packages/format-http/src/hpack/hpack-encoder.ts:39

Encodes HPACK field blocks (RFC 7541), keeping the dynamic table of one direction of a connection.

A field already in a table is sent as its index. Any other field is sent literally and added to the dynamic table, unless it is marked sensitive — then it is sent “never indexed”, so no table on the path may keep it — or it is larger than the whole table. Blocks must be sent in the order they were encoded.

Encoding is O(n·t) in the fields and the dynamic table’s entries, which the table size bounds (about 130 entries at the default 4096 octets).

new HpackEncoder(options): HpackEncoder

Defined in: packages/format-http/src/hpack/hpack-encoder.ts:47

HpackEncoderOptions

HpackEncoder

encode(fields): Uint8Array<ArrayBuffer>

Defined in: packages/format-http/src/hpack/hpack-encoder.ts:71

Encode one field block. Names must already be lowercase, and names and values Latin-1.

Iterable<HpackField>

Uint8Array<ArrayBuffer>

The block, ready to be framed.

When a name or value is not Latin-1.


setMaxTableSize(size): void

Defined in: packages/format-http/src/hpack/hpack-encoder.ts:58

Change the dynamic table size, for example when the peer’s SETTINGS_HEADER_TABLE_SIZE changes. The update is signalled at the start of the next block, with the smallest intermediate size first so the decoder evicts what this encoder evicted (§4.2).

number

void