Skip to content

feat(qpack): dynamic-table encoder driving the encoder stream#103

Merged
MagicalTux merged 1 commit into
masterfrom
qpack-dynamic-encoder
Jun 27, 2026
Merged

feat(qpack): dynamic-table encoder driving the encoder stream#103
MagicalTux merged 1 commit into
masterfrom
qpack-dynamic-encoder

Conversation

@MagicalTux

Copy link
Copy Markdown
Member

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.
  • Encoder stream (§4.3): Set Dynamic Table Capacity, Insert with Name Reference (static and dynamic/relative names), Insert with Literal Name.
  • Field sections (§4.5): non-zero Required Insert Count (§4.5.1.1 encoding), Base = RIC, dynamic indexed / name-reference representations.
  • The static-only encode_field_section path is unchanged (byte-identical; RFC B.1 vector still passes).

Correctness

  • Eviction safety — an insert is skipped (falls back to a literal) if it would evict any entry referenced earlier in the same field section, since the section is decoded as a unit after the whole encoder-stream batch.
  • Sensitive fields stay out of the table and are coded never-indexed.
  • Caller contract (documented): feed each encoder_stream to the peer's feed_encoder_stream before the matching field_section; encoder capacity must equal the decoder's SETTINGS_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-features and fmt --check clean.

🤖 Generated with Claude Code

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>
@MagicalTux MagicalTux merged commit 5e0260a into master Jun 27, 2026
42 checks passed
@MagicalTux MagicalTux deleted the qpack-dynamic-encoder branch June 27, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant