diff --git a/CHANGES/6721.misc b/CHANGES/6721.misc new file mode 100644 index 00000000000..7a17708f0fb --- /dev/null +++ b/CHANGES/6721.misc @@ -0,0 +1 @@ +Remove unused argument `max_headers` of HeadersParser. diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py index 5a756be8a46..dd1c0850e5e 100644 --- a/aiohttp/http_parser.py +++ b/aiohttp/http_parser.py @@ -125,11 +125,9 @@ class HeadersParser: def __init__( self, max_line_size: int = 8190, - max_headers: int = 32768, max_field_size: int = 8190, ) -> None: self.max_line_size = max_line_size - self.max_headers = max_headers self.max_field_size = max_field_size def parse_headers( @@ -222,7 +220,6 @@ def __init__( loop: asyncio.AbstractEventLoop, limit: int, max_line_size: int = 8190, - max_headers: int = 32768, max_field_size: int = 8190, timer: Optional[BaseTimerContext] = None, code: Optional[int] = None, @@ -236,7 +233,6 @@ def __init__( self.protocol = protocol self.loop = loop self.max_line_size = max_line_size - self.max_headers = max_headers self.max_field_size = max_field_size self.timer = timer self.code = code @@ -253,7 +249,7 @@ def __init__( self._payload_parser: Optional[HttpPayloadParser] = None self._auto_decompress = auto_decompress self._limit = limit - self._headers_parser = HeadersParser(max_line_size, max_headers, max_field_size) + self._headers_parser = HeadersParser(max_line_size, max_field_size) @abc.abstractmethod def parse_message(self, lines: List[bytes]) -> _MsgT: diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py index aa4ff64dbcd..45b6f423fc1 100644 --- a/aiohttp/web_protocol.py +++ b/aiohttp/web_protocol.py @@ -142,8 +142,6 @@ class RequestHandler(BaseProtocol): max_field_size -- Optional maximum header field size - max_headers -- Optional maximum header size - timeout_ceil_threshold -- Optional value to specify threshold to ceil() timeout values @@ -191,7 +189,6 @@ def __init__( access_log: Logger = access_logger, access_log_format: str = AccessLogger.LOG_FORMAT, max_line_size: int = 8190, - max_headers: int = 32768, max_field_size: int = 8190, lingering_time: float = 10.0, read_bufsize: int = 2**16, @@ -228,7 +225,6 @@ def __init__( read_bufsize, max_line_size=max_line_size, max_field_size=max_field_size, - max_headers=max_headers, payload_exception=RequestPayloadError, auto_decompress=auto_decompress, ) diff --git a/docs/web_reference.rst b/docs/web_reference.rst index 9cb92cf337c..353cee6187e 100644 --- a/docs/web_reference.rst +++ b/docs/web_reference.rst @@ -2598,7 +2598,6 @@ application on specific TCP or Unix socket, e.g.:: :attr:`helpers.AccessLogger.LOG_FORMAT`. :param int max_line_size: Optional maximum header line size. Default: ``8190``. - :param int max_headers: Optional maximum header size. Default: ``32768``. :param int max_field_size: Optional maximum header field size. Default: ``8190``. diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py index 13c7ce323d1..c5de9c319cf 100644 --- a/tests/test_http_parser.py +++ b/tests/test_http_parser.py @@ -58,7 +58,6 @@ def parser(loop: Any, protocol: Any, request: Any): loop, 2**16, max_line_size=8190, - max_headers=32768, max_field_size=8190, ) @@ -77,7 +76,6 @@ def response(loop: Any, protocol: Any, request: Any): loop, 2**16, max_line_size=8190, - max_headers=32768, max_field_size=8190, ) @@ -898,7 +896,6 @@ def test_parse_bad_method_for_c_parser_raises(loop: Any, protocol: Any) -> None: loop, 2**16, max_line_size=8190, - max_headers=32768, max_field_size=8190, )