[Python-checkins] r65741 - in python/trunk: Lib/urllib2.py Misc/NEWS
facundo.batista
python-checkins at python.org
Sun Aug 17 05:38:39 CEST 2008
Author: facundo.batista
Date: Sun Aug 17 05:38:39 2008
New Revision: 65741
Log:
Issue 2464. Supports a malformation in the URL received
in a redirect.
Modified:
python/trunk/Lib/urllib2.py
python/trunk/Misc/NEWS
Modified: python/trunk/Lib/urllib2.py
==============================================================================
--- python/trunk/Lib/urllib2.py (original)
+++ python/trunk/Lib/urllib2.py Sun Aug 17 05:38:39 2008
@@ -560,6 +560,14 @@
newurl = headers.getheaders('uri')[0]
else:
return
+
+ # fix a possible malformed URL
+ urlparts = urlparse.urlparse(newurl)
+ if not urlparts.path:
+ urlparts = list(urlparts)
+ urlparts[2] = "/"
+ newurl = urlparse.urlunparse(urlparts)
+
newurl = urlparse.urljoin(req.get_full_url(), newurl)
# XXX Probably want to forget about the state of the current
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Aug 17 05:38:39 2008
@@ -48,6 +48,9 @@
Library
-------
+- Issue 2464. urllib2 now supports a malformation in the URL received
+ in a redirect.
+
- Silence the DeprecationWarning raised when importing mimetools in
BaseHTTPServer, cgi (and rfc822), httplib.
More information about the Python-checkins
mailing list