Expand description
Huffman decoding for QPACK string literals (RFC 7541 Appendix B).
QPACK borrows HPACK’s Huffman code unchanged (RFC 9204 §4.1.2: “the Huffman
table from Appendix B of [RFC7541] is used without modification”), so the
table below is RFC 7541 Appendix B verbatim: one (code, bit length) pair
per symbol, in symbol order, plus the EOS symbol at index 256.
Only decoding lives here. This server never Huffman-encodes: RFC 9204 §4.1.2 leaves the choice to the encoder, a response of a few field lines saves a handful of bytes at best, and not encoding removes a whole error path from the send side.
The code is canonical — within each length the codes are consecutive and assigned in increasing symbol order — which is what makes the decoder below two small arrays rather than a tree. The unit tests re-derive that property from the table, so a mistyped entry fails the build rather than one client’s request.
Functions§
- decode
- Decodes a Huffman-encoded string literal.