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
If I try to fetch this URL using aiohttp https://cornelius-k.dk/synsproeve/, it will redirect, eventually leading to a 404 when trying to get https://cornelius-k.dk/synspr\udcf8ve at the end of the chain.
Looks like the Location header will be parsed wrongly from b'https://cornelius-k.dk/synspr\xf8ve' which I found in the Response._raw_headers.
To Reproduce
Code block:
import aiohttp
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36'
}
async def fetch_url(url):
async with aiohttp.ClientSession(headers=headers) as session:
async with session.get(url) as response:
for i in response.history:
print(i.url)
print(i._headers)
print(i._raw_headers)
return response.status
print(await fetch_url("https://cornelius-k.dk/synsproeve/"))
Final URL in the redirect chain will be https://cornelius-k.dk/synspr�ve instead of https://cornelius-k.dk/synsprøve and 404 will be yielded.
Expected behavior
Parsing URL in the redirects correctly and fetching the correct final URL.
Describe the bug
Hello,
If I try to fetch this URL using aiohttp
https://cornelius-k.dk/synsproeve/
, it will redirect, eventually leading to a 404 when trying to gethttps://cornelius-k.dk/synspr\udcf8ve
at the end of the chain.Looks like the
Location
header will be parsed wrongly fromb'https://cornelius-k.dk/synspr\xf8ve'
which I found in theResponse._raw_headers
.To Reproduce
Code block:
Final URL in the redirect chain will be
https://cornelius-k.dk/synspr�ve
instead ofhttps://cornelius-k.dk/synsprøve
and 404 will be yielded.Expected behavior
Parsing URL in the redirects correctly and fetching the correct final URL.
Logs/tracebacks
Python Version
3.9.20
aiohttp Version
3.11.7
multidict Version
6.1.0
propcache Version
0.2.0
yarl Version
1.17.1
OS
macOS
Related component
Client
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: