Skip to content

Commit

Permalink
Remove max headers parameter (#6725)
Browse files Browse the repository at this point in the history
* remove unused max_headers (#6721)

* Add change description

* Update and rename 6721.bugfix to 6721.misc

Co-authored-by: Stefan <[email protected]>
Co-authored-by: Sam Bull <[email protected]>
  • Loading branch information
3 people authored May 9, 2022
1 parent 599335a commit 056791a
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGES/6721.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove unused argument `max_headers` of HeadersParser.
6 changes: 1 addition & 5 deletions aiohttp/http_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions aiohttp/web_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
)
Expand Down
1 change: 0 additions & 1 deletion docs/web_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.

Expand Down
3 changes: 0 additions & 3 deletions tests/test_http_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand All @@ -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,
)

Expand Down Expand Up @@ -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,
)

Expand Down

0 comments on commit 056791a

Please sign in to comment.