gw-02 — Verification
One command
cd gw-02-l7-protocols && bash scripts/verify.sh
What the tests prove
| Test | Invariant |
|---|---|
TestEncodeDecodeInt | HPACK integer coding matches RFC 7541 §C.1 vectors exactly (10/5-bit, 1337/5-bit, 42/8-bit) |
TestFrameRoundTrip | frame write→read preserves type/flags/stream/payload; END_STREAM decoded |
TestReadFramesMultiplex | interleaved frames for streams 1 & 3 parse in order (multiplexing) |
TestHpackStaticIndexed | static-table indexed field decodes (0x82 → :method GET) |
TestHpackRFCRequestExamples | RFC 7541 §C.3.1 + §C.3.2 decode correctly with a persistent dynamic table (the 0xbe dynamic reference) |
TestHpackEncodeDecodeRoundTrip | encoder→decoder round-trips; a literal becomes dynamically indexable |
TestHpackDynamicEviction | dynamic-table size accounting + eviction (len+len+32, evict oldest over max) |
TestHpackHuffmanSurfaced | Huffman strings surface ErrHuffman (no silent garbage) |
TestFlowControl | two-level windows: stream-only WINDOW_UPDATE is insufficient while the conn window is 0 |
TestDemuxMultiplexing | per-stream phases + concurrent stream set reconstructed from an interleaved trace |
All under -race.
What "green" does NOT guarantee
- No Huffman codec. Real captures Huffman-code headers; this decoder
surfaces that and defers to
x/net/http2/hpack(GUIDE §2). The framing, demux, and flow control work regardless. - Not a full codec. No CONTINUATION reassembly, PRIORITY trees, or
SETTINGS negotiation state machine — out of scope; production = Envoy's
HCM /
x/net/http2. - No live gRPC LB demo in-process. The skew is reproduced as a shell exercise (steps/03) against real backends.