]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fixing 408085 - redirect from https becomes http
authorMoshe Zadka <moshez@math.huji.ac.il>
Mon, 9 Apr 2001 14:54:21 +0000 (14:54 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Mon, 9 Apr 2001 14:54:21 +0000 (14:54 +0000)
Even though relative redirects are illegal, they are common
urllib treated every relative redirect as though it was to http,
even if the original was https://
As long as we're compensating for server bugs, might as well do
it properly.

Lib/urllib.py

index 55725807017315751c6773121ca84d35629b264e..3175199a96ab6eae7721d078cbd4d7afe1ba47a3 100644 (file)
@@ -556,7 +556,7 @@ class FancyURLopener(URLopener):
         void = fp.read()
         fp.close()
         # In case the server sent a relative URL, join with original:
-        newurl = basejoin("http:" + url, newurl)
+        newurl = basejoin(self.type + ":" + url, newurl)
         if data is None:
             return self.open(newurl)
         else: