summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-03-18 11:35:18 (GMT)
committerGeorg Brandl <georg@python.org>2006-03-18 11:35:18 (GMT)
commitddb84d7c69addc5d5e2ab3e327260d97b52af3a7 (patch)
tree57e1c54f601489f4c6f8f7ce84330c6229dac4e1 /Lib
parentabd1ff8f1f6f2840345756081837994fdefaa52b (diff)
downloadcpython-ddb84d7c69addc5d5e2ab3e327260d97b52af3a7.zip
cpython-ddb84d7c69addc5d5e2ab3e327260d97b52af3a7.tar.gz
cpython-ddb84d7c69addc5d5e2ab3e327260d97b52af3a7.tar.bz2
Bug #1353433: be conciliant with spaces in redirect URLs
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib2.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 4c83bfc..0434a51 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -112,7 +112,7 @@ except ImportError:
from StringIO import StringIO
# not sure how many of these need to be gotten rid of
-from urllib import (unwrap, unquote, splittype, splithost,
+from urllib import (unwrap, unquote, splittype, splithost, quote,
addinfourl, splitport, splitgophertype, splitquery,
splitattr, ftpwrapper, noheaders, splituser, splitpasswd, splitvalue)
@@ -507,6 +507,8 @@ class HTTPRedirectHandler(BaseHandler):
# from the user (of urllib2, in this case). In practice,
# essentially all clients do redirect in this case, so we
# do the same.
+ # be conciliant with URIs containing a space
+ newurl = newurl.replace(' ', '%20')
return Request(newurl,
headers=req.headers,
origin_req_host=req.get_origin_req_host(),