diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2009-04-21 03:24:19 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2009-04-21 03:24:19 (GMT) |
commit | 7c2867fcb1ade429a41e030585332ea26e3f60e1 (patch) | |
tree | 25ce59314ae0bbace00216451fbf64ea1d3a6138 /Lib/urllib.py | |
parent | a7e734fceeeda4cd5087a0fe2f11acf8c199962c (diff) | |
download | cpython-7c2867fcb1ade429a41e030585332ea26e3f60e1.zip cpython-7c2867fcb1ade429a41e030585332ea26e3f60e1.tar.gz cpython-7c2867fcb1ade429a41e030585332ea26e3f60e1.tar.bz2 |
Fix for the Issue918368 - urllib doesn't correct server returned urls
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index 1ac997e..db2b49e 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -176,6 +176,9 @@ class URLopener: def open(self, fullurl, data=None): """Use URLopener().open(file) instead of open(file, 'r').""" fullurl = unwrap(toBytes(fullurl)) + # percent encode url, fixing lame server errors for e.g, like space + # within url paths. + fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]") if self.tempcache and fullurl in self.tempcache: filename, headers = self.tempcache[fullurl] fp = open(filename, 'rb') |