Functions
build_h2_scope
4
dict[str, Any]
▼
Build an ASGI HTTP scope from an HTTP/2 request.
Same as ``build_scope()`` for…
build_h2_scope
4
dict[str, Any]
▼
def build_h2_scope(request: RequestReceived, config: ServerConfig, client: tuple[str, int], server: tuple[str, int]) -> dict[str, Any]
Build an ASGI HTTP scope from an HTTP/2 request.
Same asbuild_scope() for H1, but sets http_version: "2"
andscheme: "https"(HTTP/2 typically requires TLS).
Parameters
| Name | Type | Description |
|---|---|---|
request |
RequestReceived |
|
config |
ServerConfig |
|
client |
tuple[str, int] |
|
server |
tuple[str, int] |
Returns
dict[str, Any]
create_h2_receive
1
Receive
▼
Create an ASGI receive callable for an HTTP/2 stream.
The worker pushes body e…
create_h2_receive
1
Receive
▼
def create_h2_receive(body_queue: asyncio.Queue[dict[str, Any]]) -> Receive
Create an ASGI receive callable for an HTTP/2 stream.
The worker pushes body events into the queue as DATA frames arrive.
Parameters
| Name | Type | Description |
|---|---|---|
body_queue |
asyncio.Queue[dict[str, Any]] |
Returns
Receive
create_h2_send
8
Send
▼
Create an ASGI send callable for an HTTP/2 stream.
Serializes via the shared H…
create_h2_send
8
Send
▼
def create_h2_send(h2_conn: H2Connection, stream_id: int, writer: asyncio.StreamWriter, state: SendState, *, timing: ServerTiming | None = None, compressor: Compressor | None = None, request_method: bytes = b'GET', request_id: str | None = None) -> Send
Create an ASGI send callable for an HTTP/2 stream.
Serializes via the shared H2Connection. After each h2 operation,
flushesdata_to_send()to the writer.
Parameters
| Name | Type | Description |
|---|---|---|
h2_conn |
H2Connection |
The H2Connection managing this connection. |
stream_id |
int |
The h2 stream identifier for this request. |
writer |
asyncio.StreamWriter |
The asyncio StreamWriter for the TCP connection. |
state |
SendState |
Mutable holder populated with response status and byte count. |
timing |
ServerTiming | None |
Optional Server-Timing builder. Default:None
|
compressor |
Compressor | None |
Optional compressor for response body. Default:None
|
request_method |
bytes |
Default:b'GET'
|
request_id |
str | None |
Default:None
|
Returns
Send
_flush
2
None
▼
Write pending h2 output bytes to the transport.
_flush
2
None
▼
def _flush(h2_conn: H2Connection, writer: asyncio.StreamWriter) -> None
Parameters
| Name | Type | Description |
|---|---|---|
h2_conn |
H2Connection |
|
writer |
asyncio.StreamWriter |