h2 only.Expand description
HTTP/2 frame codec (RFC 9113 Section 6).
Parses and writes the 9-octet frame header and every frame type: DATA, HEADERS, PRIORITY, RST_STREAM, SETTINGS, PUSH_PROMISE, PING, GOAWAY, WINDOW_UPDATE and CONTINUATION, including PADDED and PRIORITY flags. Validation covers frame-size limits, stream-id rules, settings values and field-block continuation discipline. Unknown frame types are ignored (RFC 9113 Section 4.1).
The decoder is incremental: feed it bytes with FrameDecoder::extend
and call FrameDecoder::next_frame; it returns Ok(None) until a
complete frame is buffered.
This module is the frame layer of the native HTTP/2 implementation (see CUSTOM_HTTP2_IMPL.md); stream and connection semantics (flow control, settings tracking, lifecycle) live in later steps on top of it.
Structs§
- Frame
Decoder - Incremental frame decoder over a growing buffer.
- Frame
Writer - Writes frames to an output buffer. The field-block writer
(
FrameWriter::write_field_block) splits the block across HEADERS/CONTINUATION frames at the peer’s frame-size limit. - Priority
- Stream priority (RFC 9113 Section 6.3).
- Setting
- A SETTINGS parameter (RFC 9113 Section 6.5.2).
Enums§
- Frame
- A parsed frame. Payloads are zero-copy views over the decoder’s
buffer (kept alive by
Bytesrefcounting until the frame is dropped); the connection layer reassembles field blocks from theblockfragments and applies stream semantics. Padding, when present, is validated and stripped.
Constants§
- CLIENT_
PREFACE - The HTTP/2 connection preface (RFC 9113 Section 3.5).
- DEFAULT_
INITIAL_ WINDOW_ SIZE - The initial connection flow-control window (RFC 9113 Section 5.2.1).
- DEFAULT_
MAX_ FRAME_ SIZE - The initial maximum frame payload size (RFC 9113 Section 4.2).
- FRAME_
HEADER_ LEN - Length of the fixed frame header (RFC 9113 Section 4.1).
- MAX_
FRAME_ SIZE_ LIMIT - The largest settable frame payload size (2^24-1).
- MAX_
WINDOW_ SIZE - The largest legal flow-control window (2^31-1).