]> granicus.if.org Git - python/commitdiff
Hack so that if a 302 or 301 redirect contains a relative URL, the
authorGuido van Rossum <guido@python.org>
Mon, 29 Mar 1999 20:23:41 +0000 (20:23 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 29 Mar 1999 20:23:41 +0000 (20:23 +0000)
right thing "just happens" (basejoin() with old URL).

Lib/urllib.py

index c3da7bfe004e926d121662b79fbd8106e269c7a4..9ccf9c50076cbb13b66c4e3a422fc2066afe06e8 100644 (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)