Skip to content

M2.2: Add static-only QPACK encoder #22

@RomanEmreis

Description

@RomanEmreis

Summary

Implement a minimal static-only QPACK encoder in istok-core/src/qpack/encoder.rs.

The encoder must produce valid QPACK header blocks using:

  • Indexed Field Line for exact static-table matches
  • Literal With Static Name Reference for name-only hits
  • Literal Without Name Reference otherwise

This milestone is static-table only:

  • Required Insert Count = 0
  • Delta Base = 0
  • no dynamic table
  • no Huffman

Scope

  • add encoder.rs
  • encode a slice of HeaderField pairs into a QPACK header block
  • emit the required prefix:
    • RIC = 0
    • S = 0 / Delta Base = 0
  • choose field line representation according to static-table-first rules
  • preserve field order
  • remain allocation-free and write into caller-supplied &mut [u8]

Acceptance criteria

  • encoding [(:status, "200")] produces an Indexed Field Line using static index 25
  • encoding [(:status, "999")] produces Literal With Static Name Reference
  • encoding [("x-custom", "val")] produces Literal Without Name Reference
  • encoding multiple fields preserves order
  • encoded output always starts with the two zero-byte prefixes
  • returns BufferTooSmall when the output buffer cannot fit the block
  • roundtrip with decoder (M2.3) recovers the original fields

DoD

  • all acceptance tests green
  • clippy clean
  • milestones.md updated

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions