Functions
build_h2_scope
5
dict[str, Any]
▼
Build an ASGI HTTP scope from an HTTP/2 request.
Same as ``build_scope()`` for…
build_h2_scope
5
dict[str, Any]
▼
def build_h2_scope(request: RequestReceived, config: ServerConfig, client: tuple[str, int], server: tuple[str, int], *, state: dict[str, Any] | None = None) -> dict[str, Any]
Build an ASGI HTTP scope from an HTTP/2 request.
Same as build_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] |
|
state |
dict[str, Any] | None |
Default:None
|
Returns
dict[str, Any]
create_h2_receive
2
Receive
▼
Create an ASGI receive callable for an HTTP/2 stream.
The worker pushes body e…
create_h2_receive
2
Receive
▼
def create_h2_receive(body_queue: asyncio.Queue[dict[str, Any]], *, timeout: float | None = None) -> 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]] |
|
timeout |
float | None |
Default:None
|
Returns
Receive
create_h2_send
14
Send
▼
Create an ASGI send callable for an HTTP/2 stream.
Serializes via the shared H…
create_h2_send
14
Send
▼
def create_h2_send(h2_conn: H2Connection, stream_id: int, writer: asyncio.StreamWriter, state: SendState, *, timing: ServerTiming | None = None, compressor: Compressor | None = None, dictionary_hash: str | None = None, request_method: bytes = b'GET', request_id: str | None = None, config: ServerConfig | None = None, server: tuple[str, int] | None = None, scheduler: PriorityScheduler | None = None, flow_control_updated: asyncio.Event | None = None, compression_min_size: int = 0) -> Send
Create an ASGI send callable for an HTTP/2 stream.
Serializes via the shared H2Connection. After each h2 operation,
flushes data_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
|
dictionary_hash |
str | None |
Default:None
|
request_method |
bytes |
Default:b'GET'
|
request_id |
str | None |
Default:None
|
config |
ServerConfig | None |
Default:None
|
server |
tuple[str, int] | None |
Default:None
|
scheduler |
PriorityScheduler | None |
Default:None
|
flow_control_updated |
asyncio.Event | None |
Default:None
|
compression_min_size |
int |
Default:0
|
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 |