[issue7920] urllib2.HTTPRedirectHandler incorrect redirect
Shashwat Anand
report at bugs.python.org
Sat Feb 13 00:02:43 CET 2010
Shashwat Anand <anand.shashwat at gmail.com> added the comment:
In Python 2.7a3+, trunk:78165 the code is as follows: (note that there is a segment of code to fix malformed URLs)
"""
if 'location' in headers:
newurl = headers.getheaders('location')[0]
elif 'uri' in headers:
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)
"""
----------
nosy: +l0nwlf
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7920>
_______________________________________
More information about the Python-bugs-list
mailing list