Module

sync_protocol

SyncApp protocol — fused sync request-response path for Pounce.

When a SyncApp is provided, the sync worker calls handle_sync() first. If it returns a RawResponse, the request is served without asyncio, ASGI scope, or Request/Response object construction. If it returns None, the request falls through to the full ASGI path (streaming, WebSocket, etc.).

Classes

RawRequest 8
Raw HTTP request data for the fused sync path.

Raw HTTP request data for the fused sync path.

Attributes

Name Type Description
method bytes

HTTP method as bytes (e.g., b"GET").

path bytes

Raw path bytes (no unquote).

query_string bytes

Query string as bytes (e.g., b"page=1").

headers tuple[tuple[bytes, bytes], ...]

Header pairs as a tuple of (name, value) byte pairs.

body bytes

Request body bytes.

client tuple[str, int]

Client (host, port) tuple.

server tuple[str, int]

Server (host, port) tuple.

http_version str

HTTP version string (e.g., "1.1").

RawResponse 3
Raw HTTP response for the fused sync path.

Raw HTTP response for the fused sync path.

Attributes

Name Type Description
status int

HTTP status code.

headers tuple[tuple[bytes, bytes], ...]

Header pairs as a tuple of (name, value) byte pairs.

body bytes

Response body bytes.

SyncApp 1
Protocol for sync request-response handling. When Pounce calls handle_sync(), returns RawResponse …

Protocol for sync request-response handling.

When Pounce calls handle_sync(), returns RawResponse for sync handling, or None to fall through to the full ASGI path (streaming, WebSocket, etc.).

Methods

handle_sync 1 RawResponse | None
Handle a single sync request. Returns RawResponse for sync handling, or None t…
def handle_sync(self, request: RawRequest) -> RawResponse | None

Handle a single sync request.

Returns RawResponse for sync handling, or None to fall through to ASGI.

Parameters
Name Type Description
request
Returns
RawResponse | None