Module

asgi.h3_bridge

HTTP/3 ASGI bridge — maps zoomies H3 events to ASGI scope/receive/send.

Each HTTP/3 stream maps to one ASGI invocation, similar to HTTP/2. HTTP/3 uses QUIC (UDP) transport with TLS 1.3 built-in.

Functions

build_h3_scope 6 dict[str, Any]
Build an ASGI HTTP scope from HTTP/3 HeadersReceived. Parses pseudo-headers (:…
def build_h3_scope(headers: list[tuple[bytes, bytes]], config: ServerConfig, client: tuple[str, int], server: tuple[str, int], *, stream_id: int = 0, is_0rtt: bool = False) -> dict[str, Any]

Build an ASGI HTTP scope from HTTP/3 HeadersReceived.

Parses pseudo-headers (:method, :path, :scheme, :authority) and builds the scope. HTTP/3 requires TLS, so scheme is always https.

Parameters
Name Type Description
headers list[tuple[bytes, bytes]]

HTTP/3 header list from zoomies H3HeadersReceived.

config ServerConfig

Server configuration.

client tuple[str, int]

Client (host, port) from QUIC connection.

server tuple[str, int]

Server (host, port) tuple.

stream_id int

HTTP/3 stream ID (for extensions).

Default:0
is_0rtt bool

True if request arrived via 0-RTT (replay risk).

Default:False
Returns
dict[str, Any]
create_h3_receive 1 Receive
Create an ASGI receive callable for an HTTP/3 stream. The protocol pushes body…
def create_h3_receive(body_queue: asyncio.Queue[dict[str, Any]]) -> Receive

Create an ASGI receive callable for an HTTP/3 stream.

The protocol pushes body events into the queue as DataReceived arrives.

Parameters
Name Type Description
body_queue asyncio.Queue[dict[str, Any]]
Returns
Receive
create_h3_send 8 Send
Create an ASGI send callable for an HTTP/3 stream. Serializes via zoomies H3Co…
def create_h3_send(h3_conn: H3Connection, stream_id: int, transmit: Any, state: SendState, *, timing: ServerTiming | None = None, compressor: Compressor | None = None, request_method: str = 'GET', request_id: str | None = None) -> Send

Create an ASGI send callable for an HTTP/3 stream.

Serializes via zoomies H3Connection. After each send, call transmit() to flush QUIC packets to the wire.

Parameters
Name Type Description
h3_conn H3Connection
stream_id int
transmit Any
state SendState
timing ServerTiming | None Default:None
compressor Compressor | None Default:None
request_method str Default:'GET'
request_id str | None Default:None
Returns
Send