Issue 2464. Supports a malformation in the URL received

in a redirect.
This commit is contained in:
Facundo Batista 2008-08-17 03:38:39 +00:00
parent 25f2d89f32
commit 94f243aa41
2 changed files with 11 additions and 0 deletions

View File

@ -560,6 +560,14 @@ class HTTPRedirectHandler(BaseHandler):
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

View File

@ -48,6 +48,9 @@ Core and Builtins
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.