encode_field_section
def encode_field_section(headers: List[HpackHeader], mut out: List[UInt8]) Append the QPACK-encoded field section bytes (RFC 9204 §4.5) to out.
The caller owns the buffer and may pass the same
List[UInt8] through repeated encode calls, clearing
between calls so the underlying allocation amortises across
the stream. The encoder appends only; it never reads from or
truncates the existing contents.
The static-only codec emits:
- Field section prefix: required_insert_count=0, sign=0 + delta_base=0 (two single-byte 0x00s).
- Per header, the lowest-cost wire shape:
- full match in the static table -> indexed field line
(
11ppppppfor indices < 63, with continuation bytes for higher indices; the static-table flag T is always 1). - name-only match -> literal-with-name-reference
(
0101ppppwith T=1 for static, then string literal). - no match -> literal-with-literal-name
(
0010nnnnwith H+name length, then name, then value).
- full match in the static table -> indexed field line
(
Header names must be lowercase per RFC 9114 §4.2; the encoder emits whatever case the caller provides and trusts the call site. The decoder mirrors this -- it surfaces the bytes verbatim.