-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URL Params are decoded too often #1474
Comments
Thank you for report |
No problem. Also in that context: I'd like to have a flag to mark URLs, data and params so that they won't be escaped or quoted. For testing web applications it might make sense to actually send a path or param like |
Confirmed with
For example: from yarl import URL
str(URL("'"))
str(URL("%27"))
# Both evaluates to "'" This is causing unexpected redirect loop in Right now from yarl import URL
from urllib.parse import quote
str(URL(quote("'"), encoded=True))
# Evaluates to "%27" |
i think this is fixed with yarl 0.9.1 |
@0xb35c @wenxin-wang could you check aiohttp master and yarl 0.9.1? |
@fafhrd91 I removed the original venv and used pip install git+https://github.com/KeepSafe/aiohttp.git
# aiohttp==1.3.0a0
# yarl==0.9.1 I still got the problem above. from yarl import URL
str(URL("'"))
str(URL("%27"))
# Both evaluates to "'" To be more specific, try import asyncio as aio
import aiohttp
async def get_content(session, url):
async with session.get(url) as res:
await res.release()
return res.history
async def main(loop):
async with aiohttp.ClientSession(loop=loop) as session:
return await get_content(session, "http://starbounder.org/Bolt_O's")
loop = aio.get_event_loop()
print(loop.run_until_complete(main(loop))) You will get 10 redirections where the server sent redirect to http://starbounder.org/Bolt_O%27s but the client still visit the unquoted URL. |
Are there any updates on this thread? Also, is there any way to work around this for now? Like, send a request to |
@lukkm you can use |
Hello! I have same problem. During redirect, Location header is But really request goes to url on yandex.ru it is a problem if patch UPDATE This code is working
|
added |
Long story short
Passing
a=%25s3
as a URL parameter causes an exception, saying "ValueError: Unallowed PCT %s3"a=%25s3
is at some point decoded toa=%s3
and tried to parse as URL, which is of course invalid.Expected behaviour
a=%25s3
should not be decoded toa=%s3
Actual behaviour
a=%25s3
is at some point decoded toa=%s3
and tried to parse as URLSteps to reproduce
I debugged the whole issue. It seems the problem is in the file client_reqrep.py:77-81, where (if i understand correctly) the passed params (as dict) are merged with the params already in the URL.
Here is a code snippet showing the issue.
Also here is some testcode:
Your environment
The text was updated successfully, but these errors were encountered: