-
-
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
Incorrect quoting path part of URI. #495
Comments
Couple days ago I've committed new version of url requoting, the code is borrowed from Please take a look on https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/helpers.py#L356 and https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/client_reqrep.py#L183 Is the fix satisfies your requirements? |
Thanks. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I think there is error with constructing target url in request object.
There are lines 177-178 within aiohttp/client_reqrep.py (method update_path in ClientRequest):
It says to quote path part with safe characters not needed quoting forward slash, percent sign and colon.
But according to RFC3986 section 2.3 there are unreserved characters that does not need escaping:
Python's urllib.parse.quote library does not recognize tilde sign. So it must be within safe keyword argument.
Also according of section 2.2 of same RFC there reserved characters which used as delimers or subdelimers of path sub parts. As request method receives either full URL and URL without query substring you can not if any of delimers is delimer or part of path subcomponent.
So it must be library uses's responsibility to quote or exclude reserved characters from path sub component.
Reserved characters (RFC3986 section 2.3):
Again urllib.parse.quote does not quote only forward slash. Since it is so many reserved characters quoted so I think it is mistake from your side to escape UTF-8 characters using urllib.parse.quote method.
Where such behavior is problem?. All Akamai CDNs heavy uses comma as delimer within path part of URLs. So there no way to forbid your library to stop quoting commas within path part of URL.
Example Akamai's URL:
Your library quotes commas and Akamai CDN response with 404 for such quoted URL.
My suggestions are either include all reserved & unreserved characters as safe keyword argument or provide additional keyword argument to block quoting of path part of URI in request method.
The text was updated successfully, but these errors were encountered: