From 3527f594573c56756ee8ed8cc248a101fd8e2e7a Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 29 Mar 1999 20:23:41 +0000 Subject: Hack so that if a 302 or 301 redirect contains a relative URL, the right thing "just happens" (basejoin() with old URL). --- Lib/urllib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/urllib.py b/Lib/urllib.py index c3da7bf..9ccf9c5 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) -- cgit v0.12