summaryrefslogtreecommitdiff
path: root/Lib/urllib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r--Lib/urllib.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 1ac997e2d8..db2b49ec99 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')