hypercorn.protocol.h2 module

exception hypercorn.protocol.h2.BufferCompleteError

Bases: Exception

class hypercorn.protocol.h2.H2Protocol(app: Union[Type[hypercorn.typing.ASGI2Protocol], Callable[[Union[hypercorn.typing.HTTPScope, hypercorn.typing.WebsocketScope, hypercorn.typing.LifespanScope], Callable[[], Awaitable[Union[hypercorn.typing.HTTPRequestEvent, hypercorn.typing.HTTPDisconnectEvent, hypercorn.typing.WebsocketConnectEvent, hypercorn.typing.WebsocketReceiveEvent, hypercorn.typing.WebsocketDisconnectEvent, hypercorn.typing.LifespanStartupEvent, hypercorn.typing.LifespanShutdownEvent]]], Callable[[Union[hypercorn.typing.HTTPResponseStartEvent, hypercorn.typing.HTTPResponseBodyEvent, hypercorn.typing.HTTPServerPushEvent, hypercorn.typing.HTTPDisconnectEvent, hypercorn.typing.WebsocketAcceptEvent, hypercorn.typing.WebsocketSendEvent, hypercorn.typing.WebsocketResponseStartEvent, hypercorn.typing.WebsocketResponseBodyEvent, hypercorn.typing.WebsocketCloseEvent, hypercorn.typing.LifespanStartupCompleteEvent, hypercorn.typing.LifespanStartupFailedEvent, hypercorn.typing.LifespanShutdownCompleteEvent, hypercorn.typing.LifespanShutdownFailedEvent]], Awaitable[None]]], Awaitable[None]]], config: hypercorn.config.Config, context: hypercorn.typing.WorkerContext, task_group: hypercorn.typing.TaskGroup, ssl: bool, client: Optional[Tuple[str, int]], server: Optional[Tuple[str, int]], send: Callable[[hypercorn.events.Event], Awaitable[None]])

Bases: object

async handle(event: hypercorn.events.Event) None
property idle: bool
async initiate(headers: Optional[List[Tuple[bytes, bytes]]] = None, settings: Optional[str] = None) None
async send_task() None
async stream_send(event: hypercorn.protocol.events.Event) None
class hypercorn.protocol.h2.StreamBuffer(event_class: Type[hypercorn.typing.Event])

Bases: object

async close() None
property complete: bool
async drain() None
async pop(max_length: int) bytes
async push(data: bytes) None
set_complete() None