h1_capsule (h1 v0.2.0)
View SourceRFC 9297 Capsule Protocol codec over a byte stream.
Capsules convey control information inside any HTTP tunnel. Format:
+------------+------------+ | Type (i) | Length (i) | +------------+------------+ | Payload (*) | +-------------------------+
Type and Length are QUIC variable-length integers (RFC 9000 section 16).
This module is a pure codec: it owns no socket. Callers (including masque-over-H1) drive reads/writes themselves, feeding bytes in and retrieving capsules out. Identical wire format to h2_capsule and quic_h3_capsule so the three modules are interchangeable at the byte-stream level.
Summary
Types
-type capsule() :: {Type :: capsule_type(), Payload :: binary()}.
-type capsule_type() :: non_neg_integer() | atom().
Functions
-spec decode(binary()) -> {ok, capsule(), binary()} | {more, pos_integer()} | {error, term()}.
-spec decode_type(non_neg_integer()) -> non_neg_integer() | atom().
-spec encode(capsule_type(), binary()) -> binary().
-spec encode_type(atom()) -> non_neg_integer().