Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/gunicorn/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "25.2.0"
version = "25.3.0"
upstream_repository = "https://github.com/benoitc/gunicorn"
requires = ["types-gevent"]

Expand Down
3 changes: 1 addition & 2 deletions stubs/gunicorn/gunicorn/asgi/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from gunicorn.asgi.lifespan import LifespanManager as LifespanManager
from gunicorn.asgi.message import AsyncRequest as AsyncRequest
from gunicorn.asgi.unreader import AsyncUnreader as AsyncUnreader

__all__ = ["AsyncUnreader", "AsyncRequest", "LifespanManager"]
__all__ = ["AsyncUnreader", "LifespanManager"]
50 changes: 0 additions & 50 deletions stubs/gunicorn/gunicorn/asgi/message.pyi

This file was deleted.

50 changes: 49 additions & 1 deletion stubs/gunicorn/gunicorn/asgi/parser.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,57 @@
from collections.abc import Callable, Iterable
from typing import Any, Literal, SupportsIndex
from enum import IntEnum
from typing import Any, Final, Literal, SupportsIndex, TypedDict, type_check_only
from typing_extensions import Self, TypeAlias

_H1CProtocol: TypeAlias = Any # gunicorn_h1c H1CProtocol class

class ParseError(Exception): ...
class InvalidProxyLine(ParseError): ...
class InvalidProxyHeader(ParseError): ...

PP_V2_SIGNATURE: Final[bytes]

class PPCommand(IntEnum):
LOCAL = 0x0
PROXY = 0x1

class PPFamily(IntEnum):
UNSPEC = 0x0
INET = 0x1
INET6 = 0x2
UNIX = 0x3

class PPProtocol(IntEnum):
UNSPEC = 0x0
STREAM = 0x1
DGRAM = 0x2

class LimitRequestLine(ParseError): ...
class InvalidRequestLine(ParseError): ...
class LimitRequestHeaders(ParseError): ...
class InvalidRequestMethod(ParseError): ...
class InvalidHTTPVersion(ParseError): ...
class InvalidHeaderName(ParseError): ...
class InvalidHeader(ParseError): ...
class UnsupportedTransferCoding(ParseError): ...
class InvalidChunkSize(ParseError): ...
class InvalidChunkExtension(ParseError): ...

@type_check_only
class _ProxyProtocolInfo(TypedDict):
proxy_protocol: Literal["TCP4", "TCP6", "UDP4", "UDP6"]
client_addr: str
client_port: int
proxy_addr: str
proxy_port: int

@type_check_only
class _ProxyProtocolInfoUnknown(TypedDict):
proxy_protocol: Literal["UNKNOWN", "LOCAL", "UNSPEC"]
client_addr: None
client_port: None
proxy_addr: None
proxy_port: None

class PythonProtocol:
__slots__ = (
Expand Down Expand Up @@ -42,6 +83,9 @@ class PythonProtocol:
"_permit_unconventional_http_method",
"_permit_unconventional_http_version",
"_header_count",
"_proxy_protocol",
"_proxy_protocol_info",
"_proxy_protocol_done",
)
method: bytes | None
path: bytes | None
Expand All @@ -65,9 +109,13 @@ class PythonProtocol:
limit_request_field_size: int = 8190,
permit_unconventional_http_method: bool = False,
permit_unconventional_http_version: bool = False,
proxy_protocol: Literal["off", "v1", "v2", "auto"] = "off",
) -> None: ...
def feed(self, data: Iterable[SupportsIndex]) -> None: ...
@property
def proxy_protocol_info(self) -> _ProxyProtocolInfo | _ProxyProtocolInfoUnknown | None: ...
def reset(self) -> None: ...
def finish(self) -> None: ...

class CallbackRequest:
__slots__ = (
Expand Down
4 changes: 4 additions & 0 deletions stubs/gunicorn/gunicorn/http/errors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class ChunkMissingTerminator(IOError):

def __init__(self, term: bytes) -> None: ...

class InvalidChunkExtension(IOError):
reason: str
def __init__(self, reason: str) -> None: ...

class LimitRequestLine(ParseException):
size: int
max_size: int | None
Expand Down
Loading