mirror of https://github.com/python/cpython
Issue 2464. Supports a malformation in the URL received
in a redirect.
This commit is contained in:
parent
25f2d89f32
commit
94f243aa41
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue