You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The changes between yarl 1.12.0 and 1.13.0 have broken the URL parsing in aiohttp when any port is part of the host header. I believe aio-libs/yarl#954 is proximate cause.
The following report primarily refers to a yarl 1.14.0 build, but the reproducer also affected 1.13.0.
To Reproduce
Install aiohttp (3.9.5 was used here), and yarl==1.13 or yarl==1.14
I should be able to access the url property of an incoming request.
Logs/tracebacks
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
Error handling request
Traceback (most recent call last):
File "./venv/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp =await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp =await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "./src/test.py", line 5, in demoprint(req.url)
^^^^^^^
File "aiohttp/_helpers.pyx", line 26, in aiohttp._helpers.reify.__get__
File "./venv/lib/python3.12/site-packages/aiohttp/web_request.py", line 452, in url
url =URL.build(scheme=self.scheme, host=self.host)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/yarl/_url.py", line 386, in build
netloc =cls._make_netloc(
^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/yarl/_url.py", line 1066, in _make_netloc
ret =cls._encode_host(host) if encode_host else host
^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/yarl/_url.py", line 1049, in _encode_host
_host_validate(host)
File "./venv/lib/python3.12/site-packages/yarl/_url.py", line 1616, in _host_validateraiseValueError(
ValueError: Host '0.0.0.0:8080' cannot contain ':' (at position 7)
Ah, I had an overly tight pin on aiohttp (~= 3.9.5 rather than ~=3.9).
Changing that caused it to rebuild with 3.10.x, which fixed the issue.
Apologies for the noise -- I missed the yarl 1.13 MR on the first pass as I thought it was yarl 1.14, and didn't do my due diligence looking for related issues older than 24 hours.
Describe the bug
The changes between
yarl
1.12.0 and 1.13.0 have broken the URL parsing inaiohttp
when any port is part of the host header. I believe aio-libs/yarl#954 is proximate cause.The following report primarily refers to a yarl 1.14.0 build, but the reproducer also affected 1.13.0.
To Reproduce
aiohttp
(3.9.5 was used here), andyarl==1.13
oryarl==1.14
http://localhost:8080/
Expected behaviour
I should be able to access the
url
property of an incoming request.Logs/tracebacks
Python Version
aiohttp Version
multidict Version
propcache Version
yarl Version
OS
Linux Debian
Linux [redacted] 5.10.0-24-amd64 #1 SMP Debian 5.10.179-5 (2023-08-08) x86_64 Linux
Related component
Server
Code of Conduct
The text was updated successfully, but these errors were encountered: