The client-side mirror of :mod:flare.http3.response_writer. Builds
the bytes an HTTP/3 client hands to the QUIC stream layer for a
request on a client-initiated bidirectional stream, plus the
preambles for the client's unidirectional control + QPACK streams.
A complete H3 request is at most three concatenated wire fragments
on the request (bidi) stream:
HEADERS frame (:method / :scheme / :authority /
:path pseudo-headers + application headers,
QPACK-encoded)
DATA frame (zero or more, request body)
HEADERS frame (optional trailers, QPACK-encoded)
Before any request, the client opens three unidirectional streams
(RFC 9114 §6.2): the control stream (type 0x00, carrying SETTINGS
first) and the QPACK encoder / decoder streams (types 0x02 / 0x03,
empty in the static-only table mode flare uses). The preamble
encoders here emit the leading stream-type varint + initial frame
so the caller can ship them as the first bytes of each uni-stream.
Public surface:
- :func:
encode_request_headers -- the initial HEADERS frame with
the four request pseudo-headers in canonical order (RFC 9114
§4.3.1) followed by the application headers (lowercased).
- :func:
encode_request_data -- wrap a body chunk in a DATA frame.
- :func:
encode_request_trailers -- the trailing HEADERS frame.
- :func:
encode_client_control_stream -- the control-stream type
byte + the client's SETTINGS frame (the mandatory first frame,
RFC 9114 §6.2.1).
- :func:
encode_qpack_encoder_stream / :func:encode_qpack_decoder_stream
-- the single stream-type byte for each QPACK uni-stream.
Sans-I/O contract: every entry point is a pure function over its
inputs; the QUIC client driver owns the per-stream cursor + FIN.
References:
- RFC 9114 §4 (HTTP Message Exchanges) + §6.2 (uni-streams) + §7.
- RFC 9204 (QPACK) -- static-table field-section encoder.