kennethreitz/requests — Issue #460: Path quoting is unnecessarily aggressive
Author: dvogel
Created: 2012-02-27 19:11:18+00:00
State: open

`utils.requote_path` passes `safe=b""` into `urllib.quote`, which causes some characters to be encoded that don't have to be. This is allowed by the [RFC](http://www.faqs.org/rfcs/rfc1738.html), however there is some ambiguity in the RFC as to whether the encoded characters have the same meaning as their unencoded representations. This ambiguity allows [some web servers](http://www.latimes.com/health/la-he-qnexa-fda-20120223,0,1643846.story) to consider */a,b* and */a%2Cb* to refer to different resources. I think we should only encode characters that must be encoded, as that should lead to the widest compatibility. This would mean passing `safe=b"$+!*'(),"` to urllib.quote. Alternatively, `Request` could acccept a parameter to pass on as the `safe` argument to `urllib.quote`.