Functions
_get_header_from_tuple
2
bytes | None
▼
Get a header value by lowercase name from a headers tuple.
_get_header_from_tuple
2
bytes | None
▼
def _get_header_from_tuple(headers: tuple[tuple[bytes, bytes], ...], name: bytes) -> bytes | None
Parameters
| Name | Type | Description |
|---|---|---|
headers |
tuple[tuple[bytes, bytes], ...] |
|
name |
bytes |
Returns
bytes | None
handle_h2_connection
8
None
▼
Handle a full HTTP/2 connection with multiplexed streams.
Runs one ASGI task p…
async
handle_h2_connection
8
None
▼
async def handle_h2_connection(app: ASGIApp, config: ServerConfig, logger: logging.Logger, reader: asyncio.StreamReader, writer: asyncio.StreamWriter, client: tuple[str, int], server: tuple[str, int], client_str: str) -> None
Handle a full HTTP/2 connection with multiplexed streams.
Runs one ASGI task per stream. The main loop reads data from the
network, feeds it toH2Connection, and dispatches per-stream
events to the appropriate ASGI task.
Parameters
| Name | Type | Description |
|---|---|---|
app |
ASGIApp |
The ASGI application callable. |
config |
ServerConfig |
Immutable server configuration. |
logger |
logging.Logger |
Logger scoped to the worker. |
reader |
asyncio.StreamReader |
Asyncio stream reader for the connection. |
writer |
asyncio.StreamWriter |
Asyncio stream writer for the connection. |
client |
tuple[str, int] |
|
server |
tuple[str, int] |
|
client_str |
str |
Formatted |
handle_h2_websocket_stream
11
None
▼
Handle a WebSocket-over-HTTP/2 stream (RFC 8441).
The Extended CONNECT bootstr…
async
handle_h2_websocket_stream
11
None
▼
async def handle_h2_websocket_stream(app: ASGIApp, config: ServerConfig, logger: logging.Logger, h2_conn: object, stream_id: int, request: RequestReceived, data_queue: asyncio.Queue[dict], writer: asyncio.StreamWriter, client: tuple[str, int], server: tuple[str, int], client_str: str) -> None
Handle a WebSocket-over-HTTP/2 stream (RFC 8441).
The Extended CONNECT bootstraps a WebSocket session within an H2
stream. Data frames on this stream carry WebSocket frames (via
wsproto), and the ASGI app sees a standardwebsocketscope.
Parameters
| Name | Type | Description |
|---|---|---|
app |
ASGIApp |
The ASGI application callable. |
config |
ServerConfig |
Immutable server configuration. |
logger |
logging.Logger |
Logger scoped to the worker. |
h2_conn |
object |
The |
stream_id |
int |
The H2 stream identifier for this WebSocket session. |
request |
RequestReceived |
The parsed request event (Extended CONNECT). |
data_queue |
asyncio.Queue[dict] |
Queue fed by the H2 connection's event loop. |
writer |
asyncio.StreamWriter |
Asyncio stream writer for the connection. |
client |
tuple[str, int] |
|
server |
tuple[str, int] |
|
client_str |
str |
Formatted |