Skip to main content

Module h3

Module h3 

Source
Expand description

HTTP/3 (RFC 9114) for a proxy, implemented in the tree.

This is the server half of HTTP/3 and nothing else: it accepts request streams, decodes a request, sends a response, moves body bytes, and hands each inbound HTTP Datagram to the request stream it names. There is no client, no server push, no WebTransport, and no QPACK dynamic table – every one of them is either unreachable for a CONNECT proxy or refused as a protocol violation, so leaving them out costs no conformance.

§Layout

  • error — the RFC 9114 §8.1 codes, and the two error types the rest of the crate sees.
  • huffman — RFC 7541 Appendix B, decoding only.
  • qpack — RFC 9204 field sections against the static table.
  • frame — RFC 9114 §7 framing, incremental and copy-free for DATA.
  • message — what a request and a response are made of: a status, a method, field lines.
  • connection — the connection: SETTINGS, the control stream, GOAWAY, and inbound HTTP Datagram routing (RFC 9297).
  • stream — one request stream, from its HEADERS to its last byte.

§Why it exists

It replaces the h3 and h3-quinn crates, which are no longer in the tree at all. They were pinned to a git revision because the published releases carried bugs a proxy cannot live with, and being generic over any QUIC stack cost this server – which has exactly one – more than it bought. What a proxy asks of HTTP/3 turned out to be small enough to state in full, which is what the modules above do.

The integration suite’s client is built on these same modules (tests/common/h3client.rs), so the check that this server has not misunderstood the wire in a way a peer would notice belongs entirely to the interop CI job, which drives a real server with Go’s masque-go.

§What holds it together

  • Nothing is generic over the QUIC layer. The types are quinn’s, and the indirection a library needs in order to back any stack is gone. quinn::SendStream and quinn::RecvStream are held directly, which also means their Drop behaviour – a finish on the send side, STOP_SENDING on the receive side – is what tunnel::tcp reasons about, unmediated.
  • The peer’s state is shared, not polled. One background task per connection reads every unidirectional stream and every datagram, so the peer’s SETTINGS take effect the moment they arrive rather than the next time a request is accepted.
  • A connection error is a quinn::Connection::close. RFC 9114 §8 makes an HTTP/3 connection error a QUIC CONNECTION_CLOSE carrying the HTTP/3 code, which is exactly what that call sends; every operation still in flight then fails on its own.

Modules§

connection
One server-side HTTP/3 connection: SETTINGS, the control stream, GOAWAY.
error
HTTP/3 error codes and the two error types the rest of the crate sees.
frame
The HTTP/3 frame layer (RFC 9114 §7).
huffman
Huffman decoding for QPACK string literals (RFC 7541 Appendix B).
message
What a request and a response are made of: a status, a method, field lines.
qpack
QPACK field-section coding (RFC 9204), static table only.
stream
One request stream, from its HEADERS frame to its last byte.

Constants§

HEADERS_BUFFER_BUDGET
Most encoded frame payload one connection may hold buffered at once, in bytes (D77).
MAX_FIELD_SECTION_SIZE
Largest field section this server will decode, in bytes.

Functions§

varint
An HTTP/3 error code as the QUIC application error code that carries it.