[Python-checkins] r43132 - python/trunk/Lib/urllib2.py

georg.brandl python-checkins at python.org
Sat Mar 18 12:35:19 CET 2006


Author: georg.brandl
Date: Sat Mar 18 12:35:18 2006
New Revision: 43132
Modified:
 python/trunk/Lib/urllib2.py
Log:
Bug #1353433: be conciliant with spaces in redirect URLs
Modified: python/trunk/Lib/urllib2.py
==============================================================================
--- python/trunk/Lib/urllib2.py	(original)
+++ python/trunk/Lib/urllib2.py	Sat Mar 18 12:35:18 2006
@@ -112,7 +112,7 @@
 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 @@
 # 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(),


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /