Skip to content

Parse HTTP2, demultiplexing & remultiplexing #978

Closed

Description

@Keksoj

The parsing will be done in Kawa, see the corresponding issue.

Sōzu should be able to demultiplex incoming HTTP2 connections, remultiplex Kawa buffers.
Additionaly, we need a procedure to run hpack before traffic reaches the kawa layer, since kawa can not decompress headers.


Update — 2026-04-24

Implemented on feat/h2-mux (PR #1209):

  • lib/src/protocol/mux/parser.rs (~2180 LOC) — nom-based H2 binary frame parser covering all frame types, with take(payload_len) symmetry for fixed-length frames.
  • lib/src/protocol/mux/pkawa.rs (~2195 LOC) — HPACK decode bridge (loona-hpack) producing kawa Blocks with full RFC 9113 header validation, cookie splitting, Content-Length enforcement, and RFC 9218 priority parsing.
  • lib/src/protocol/mux/converter.rs (~1410 LOC) — kawa → H2 wire conversion via H2BlockConverter with reusable cookie/converter buffers.
  • lib/src/protocol/mux/serializer.rs (~557 LOC) — H2 binary frame serializer with R-bit masking.

Demultiplexing and remultiplexing run through a shared Vec<Stream> keyed by GlobalStreamId, owned by Context<L> in mod.rs. Buffers come from the poole pooled slab allocator.

Suggest closing on merge of #1209.

Activity

  1. added this to the HTTP2 milestone on Aug 9, 2023
  2. FlorentinDUBOIS commented on Apr 27, 2026

    @FlorentinDUBOIS
    Collaborator

    Closed by #1209 — feat(h2): HTTP/2 support via unified Mux session layer.

    H2 demultiplexing and remultiplexing are now implemented in the Mux session:

    • kawa provides the unified HTTP representation (headers, body, trailers as Blocks) so streams can be expressed identically in H1 and H2.
    • nom parses the H2 binary frame layer (lib/src/protocol/mux/parser.rs).
    • loona-hpack handles HPACK header compression/decompression.
    • poole provides the pooled slab buffer allocator.

    The Stream abstraction with front: Kawa<Checkout> / back: Kawa<Checkout> pairs lets a single H2 connection demultiplex across multiple H1 (or H2) backends transparently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions