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
aiohttp Version
multidict Version
propcache Version
yarl Version
OS
macOS
Related component
Client
Additional context
No response
Code of Conduct