h3 only.Expand description
QPACK encoder (RFC 9204 Sections 4.3 and 4.5).
Consumption: the HTTP/3 layer drives the encoder per connection (it feeds
field sections and drains the encoder stream); until that lands, the whole
module is dead in non-test builds, which is why dead_code is expected
here. It errors again once the encoder is used, reminding us to remove the
expectation.
The encoder owns the shared dynamic table (Section 4.2): it alone adds entries, and it emits an unframed sequence of instructions on the encoder stream (Section 4.3) describing every mutation. Field sections are encoded as a Required Insert Count, a Base, and one or more field line representations (Section 4.5).
The encoder fixes the Base at the dynamic table insertion count before encoding a section, so every reference to entries that existed before the section is relative, and entries inserted while encoding the section are referenced with post-Base indexes (Section 4.5.1.2 recommends exactly this: Base equal to the Required Insert Count, which makes the Sign bit and the Delta Base zero whenever nothing new is referenced).
Inserts are speculative but bounded: an entry is only inserted when it fits and when the eviction it would cause cannot invalidate an index already referenced by the section being encoded, nor remove an entry the decoder still needs. The decoder’s acknowledgments (Section 4.4 instructions on its decoder stream) raise a Known Received Count and free the references of acknowledged field sections; an entry is evictable only below the lower of the Known Received Count and the smallest reference still outstanding (RFC 9204 Sections 2.1.1 and 2.1.4). The encoder never evicts above that floor, so the peer’s decoder never has to reject an insert as a QPACK_ENCODER_STREAM_ERROR.
Huffman encoding follows RFC 9204 Section 4.1.2: a string is Huffman encoded when that is shorter, matching HPACK practice.
Structs§
- Encoded
Section - Result of encoding one field section: the encoded field section carried on the request/response stream, and any encoder stream instructions queued while encoding it.
- Encoder
- QPACK encoder: dynamic table owner and field section encoder.