Issue #14132: Fix redirect handling when target is just a query string

This commit is contained in:
Martin Panter 2016-05-16 01:07:13 +00:00
parent f95455da4c
commit ce6e06874b
4 changed files with 25 additions and 5 deletions

View file

@ -652,7 +652,7 @@ class HTTPRedirectHandler(BaseHandler):
"%s - Redirection to url '%s' is not allowed" % (msg, newurl),
headers, fp)
if not urlparts.path:
if not urlparts.path and urlparts.netloc:
urlparts = list(urlparts)
urlparts[2] = "/"
newurl = urlunparse(urlparts)