Classes
SendfileRegion
4
▼
Protocol-owned file body marker.
h11's passthrough send path only needs ``len(data)`` for body acc…
SendfileRegion
4
▼
Protocol-owned file body marker.
h11's passthrough send path only needslen(data)for body accounting.
The ASGI bridge recognizes this marker and transfers the referenced file
range withos.sendfileafter writing h11's surrounding framing bytes.
Attributes
| Name | Type | Description |
|---|---|---|
path |
Path
|
— |
offset |
int
|
— |
count |
int
|
— |
Methods
Internal Methods 1 ▼
__len__
0
int
▼
__len__
0
int
▼
def __len__(self) -> int
Returns
int
Functions
can_use_sendfile
1
bool
▼
Check if sendfile can be used on this connection.
Returns False for TLS connec…
can_use_sendfile
1
bool
▼
def can_use_sendfile(writer: asyncio.StreamWriter) -> bool
Check if sendfile can be used on this connection.
Returns False for TLS connections and when the raw socket is unavailable.
Parameters
| Name | Type | Description |
|---|---|---|
writer |
asyncio.StreamWriter |
Returns
bool
create_sendfile_callable
1
SendfileCallable
▼
Create an async sendfile callable bound to this writer's transport.
The return…
create_sendfile_callable
1
SendfileCallable
▼
def create_sendfile_callable(writer: asyncio.StreamWriter) -> SendfileCallable
Create an async sendfile callable bound to this writer's transport.
The returned callable transfers file data to the socket using
loop.sendfile(), which handles non-blocking-socket back-pressure
(EAGAIN) via the selector instead of crashing in an executor thread.
Parameters
| Name | Type | Description |
|---|---|---|
writer |
asyncio.StreamWriter |
The asyncio StreamWriter for the connection. |
Returns
SendfileCallable