QpackEncoder
Defined in: packages/format-http/src/qpack/qpack-encoder.ts:39
Encodes QPACK field sections (RFC 9204) for one HTTP/3 connection.
This encoder uses the static table and literals only, never the dynamic table: its sections never block the peer and need no acknowledgement, at some cost in size for repeated non-static fields. It still reads the peer’s decoder stream (receiveDecoderInstructions), which QPACK requires to be valid, and takeInstructions has nothing to send.
Encoding is O(n) in the fields’ total length.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new QpackEncoder(
options?):QpackEncoder
Defined in: packages/format-http/src/qpack/qpack-encoder.ts:43
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”QpackEncoder
Methods
Section titled “Methods”encode()
Section titled “encode()”encode(
streamId,fields):Uint8Array<ArrayBuffer>
Defined in: packages/format-http/src/qpack/qpack-encoder.ts:57
Encode one field section for streamId. Names must already be lowercase,
and names and values Latin-1. A sensitive field is sent with the ‘N’ bit,
so no table on the path may keep it.
Parameters
Section titled “Parameters”streamId
Section titled “streamId”number
The stream the section is sent on, which a dynamic table reference would be acknowledged by.
fields
Section titled “fields”Iterable<HpackField>
Returns
Section titled “Returns”Uint8Array<ArrayBuffer>
The section, ready to be the payload of a HEADERS frame.
Throws
Section titled “Throws”When a name or value is not Latin-1.
receiveDecoderInstructions()
Section titled “receiveDecoderInstructions()”receiveDecoderInstructions(
chunk):void
Defined in: packages/format-http/src/qpack/qpack-encoder.ts:91
Read instructions from the peer’s decoder stream, in any chunking.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”void
Throws
Section titled “Throws”QPACK_DECODER_STREAM_ERROR when an instruction is
invalid: acknowledging a section or insertions this encoder never sent.
takeInstructions()
Section titled “takeInstructions()”takeInstructions():
Uint8Array<ArrayBuffer> |null
Defined in: packages/format-http/src/qpack/qpack-encoder.ts:136
Encoder stream bytes to send, or null when there are none — always, as
this encoder never changes the dynamic table.
Returns
Section titled “Returns”Uint8Array<ArrayBuffer> | null