[issue13359] urllib2 doesn't escape spaces in http requests
Senko Rasic
report at bugs.python.org
Sat Jul 6 12:08:12 CEST 2013
Senko Rasic added the comment:
I vote for the parse method converting the spaces (and only the spaces) explicitly, for the following reasons:
* the spaces must be encoded for the server to accept them
* no user-encoded url will ever have spaces in them
* space quoting is idempotent: quote(quote(' ')) == quote(' ')
* if the user did get an exception from Request in case of invalid url containing the spaces, the only thing he or she can do is to quote the url string
Here's a patch implementing this. The change allows for any whitespace character in the selector part of the url (and in particular, '\n'), not only ' '.
----------
nosy: +senko
Added file: http://bugs.python.org/file30795/urllib-request-space-encode.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13359>
_______________________________________
More information about the Python-bugs-list
mailing list