nhttp_qpack_encoder_instruction (nhttp_lib v1.0.0)
View SourceEncoder instructions wire format (RFC 9204 Section 4.3).
Encoder instructions flow from encoder to decoder on the encoder unidirectional stream. They modify the decoder's copy of the dynamic table.
Four instruction types are defined:
- Set Dynamic Table Capacity (Section 4.3.1)
- Insert with Name Reference (Section 4.3.2)
- Insert with Literal Name (Section 4.3.3)
- Duplicate (Section 4.3.4)
Summary
Functions
Decode a single encoder instruction from a binary.
Encode a Duplicate instruction.
Wire format: 000 prefix + 5-bit prefixed integer (relative index).
Encode an Insert with Literal Name instruction.
Wire format: 01 + H-bit + 5-bit prefixed name string + value
string literal. The Huffman flag applies to both name and value.
Encode an Insert with Name Reference instruction.
Wire format: 1 + T-bit (1=static, 0=dynamic) + 6-bit prefixed
integer (name index) + value string literal.
Encode a Set Dynamic Table Capacity instruction.
Wire format: 001 prefix + 5-bit prefixed integer.
Types
-type decode_error() :: incomplete | invalid_huffman | nhttp_int:decode_error().
-type t() :: {set_capacity, non_neg_integer()} | {insert_name_ref, static | dynamic, non_neg_integer(), binary()} | {insert_literal_name, binary(), binary()} | {duplicate, non_neg_integer()}.
Functions
-spec decode(binary()) -> {ok, t(), bitstring()} | {error, decode_error()}.
Decode a single encoder instruction from a binary.
Returns the decoded instruction and unconsumed bytes, or an error if the data is incomplete or contains invalid Huffman coding.
-spec encode_duplicate(non_neg_integer()) -> iolist().
Encode a Duplicate instruction.
Wire format: 000 prefix + 5-bit prefixed integer (relative index).
Encode an Insert with Literal Name instruction.
Wire format: 01 + H-bit + 5-bit prefixed name string + value
string literal. The Huffman flag applies to both name and value.
-spec encode_insert_name_ref(static | dynamic, non_neg_integer(), binary(), boolean()) -> iolist().
Encode an Insert with Name Reference instruction.
Wire format: 1 + T-bit (1=static, 0=dynamic) + 6-bit prefixed
integer (name index) + value string literal.
-spec encode_set_capacity(non_neg_integer()) -> iolist().
Encode a Set Dynamic Table Capacity instruction.
Wire format: 001 prefix + 5-bit prefixed integer.