summaryrefslogtreecommitdiffstats
path: root/Lib/urllib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-03-29 20:23:41 (GMT)
committerGuido van Rossum <guido@python.org>1999-03-29 20:23:41 (GMT)
commit3527f594573c56756ee8ed8cc248a101fd8e2e7a (patch)
tree7f4426fd3d4c46205b8ace69ec582216d021469e /Lib/urllib.py
parentc91fcaa43b5348ffad993b7e7da251f41abb46d2 (diff)
downloadcpython-3527f594573c56756ee8ed8cc248a101fd8e2e7a.zip
cpython-3527f594573c56756ee8ed8cc248a101fd8e2e7a.tar.gz
cpython-3527f594573c56756ee8ed8cc248a101fd8e2e7a.tar.bz2
Hack so that if a 302 or 301 redirect contains a relative URL, the
right thing "just happens" (basejoin() with old URL).
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r--Lib/urllib.py2
1 files changed, 2 insertions, 0 deletions
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)