Skip to content

HttpParser argument max_headers is not enforced #6721

Closed
@starflows

Description

Describe the bug

The max_headers argument is not used. It does not limit the number of headers allowed in a response.

To Reproduce

See the failing unittest

async def test_max_headers_session_default_fail(aiohttp_client: Any) -> None:

Expected behavior

I assume the argument should limit how many headers a response may have.
I expect the request to fail if too many headers are returned.

Logs/tracebacks

The new unittest https://github.com/aio-libs/aiohttp/blob/188852b8d9ff082ce7793f3f8d03128cc62f3ac1/tests/test_client_functional.py#L3155 of https://github.com/aio-libs/aiohttp/pull/6720 does not fail although more than the allowed 32768 headers are returned.

Python Version

$ python --version
Python 3.10.4

aiohttp Version

$ python -m pip show aiohttp
Name: aiohttp
Version: 4.0.0a1
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author: 
Author-email: 
License: Apache 2
Location: /home/work/starflows/aiohttp
Requires: aiosignal, async_timeout, charset-normalizer, frozenlist, multidict, typing_extensions, yarl
Required-by:

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 5.2.0
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache 2
Location: /home/work/starflows/aiohttp/venv/lib/python3.10/site-packages
Requires: 
Required-by: aiohttp, yarl

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.7.2
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl/
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache 2
Location: /home/work/starflows/aiohttp/venv/lib/python3.10/site-packages
Requires: idna, multidict
Required-by: aiohttp

OS

Arch Linux 5.17.4-arch1-1

Related component

Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions