From: Guido van Rossum Date: Mon, 29 Mar 1999 20:23:41 +0000 (+0000) Subject: Hack so that if a 302 or 301 redirect contains a relative URL, the X-Git-Tag: v1.5.2c1~55 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3527f594573c56756ee8ed8cc248a101fd8e2e7a;p=python Hack so that if a 302 or 301 redirect contains a relative URL, the right thing "just happens" (basejoin() with old URL). --- diff --git a/Lib/urllib.py b/Lib/urllib.py index c3da7bfe00..9ccf9c5007 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -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)