feat(qpack): dynamic-table encoder driving the encoder stream#103
Merged
Conversation
QPACK previously had a full decoder but a static-only encoder. Add a dynamic-table encoder so the send path is fully bidirectional, matching HPACK. QpackEncoder::with_dynamic_table + encode() return an Encoded pair: the encoder-stream instructions (Set Dynamic Table Capacity, Insert with Name Reference against static/dynamic names, Insert with Literal Name) and a field section with dynamic indexed / name-reference representations and a non-zero Required Insert Count (Base = RIC, no post-base forms). Entries referenced by a field section are never evicted by inserts in the same batch (the section is decoded as a unit after the whole encoder-stream chunk); sensitive fields stay out of the table and are coded never-indexed. The static-only encode_field_section path is unchanged (byte-identical). Adds DynamicTable::find / evict_floor for the encoder mirror, 11 round-trip tests through the existing decoder, and updates README/CHANGELOG/module docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QPACK previously shipped a full decoder but a static-only encoder. This adds a dynamic-table encoder so the send path is fully bidirectional, matching HPACK.
QpackEncoder::with_dynamic_table(max_table_capacity)+encode(&fields) -> Encoded { encoder_stream, field_section }— maintains a mirror of the peer decoder's dynamic table and returns both QUIC streams.encode_field_sectionpath is unchanged (byte-identical; RFC B.1 vector still passes).Correctness
encoder_streamto the peer'sfeed_encoder_streambefore the matchingfield_section; encoder capacity must equal the decoder'sSETTINGS_QPACK_MAX_TABLE_CAPACITY.Tests
11 new round-trip tests through the existing decoder (literal/static/dynamic-name inserts, entry reuse, mixed, Huffman, eviction safety, sensitive, cross-section). Full lib + doctests pass; the 5 RFC 9204 Appendix B decoder vectors are untouched;
clippy --all-featuresandfmt --checkclean.🤖 Generated with Claude Code