Hack so that if a 302 or 301 redirect contains a relative URL, the

right thing "just happens" (basejoin() with old URL).
This commit is contained in:
Guido van Rossum 1999-03-29 20:23:41 +00:00
parent c91fcaa43b
commit 3527f59457

View file

@ -451,6 +451,8 @@ class FancyURLopener(URLopener):
return
void = fp.read()
fp.close()
# In case the server sent a relative URL, join with original:
newurl = basejoin("http:" + url, newurl)
return self.open(newurl, data)
# Error 301 -- also relocated (permanently)