summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-10-10 16:01:16 (GMT)
committerGuido van Rossum <guido@python.org>1996-10-10 16:01:16 (GMT)
commitb030bc026eb57861568fdc9310512185c95a6f11 (patch)
tree59ea60cb85353f058d38b383eed94aef4e6602de
parentb5fa1cb855a641d029eed5309cb34da0e94a2d40 (diff)
downloadcpython-b030bc026eb57861568fdc9310512185c95a6f11.zip
cpython-b030bc026eb57861568fdc9310512185c95a6f11.tar.gz
cpython-b030bc026eb57861568fdc9310512185c95a6f11.tar.bz2
Fix some cases where self.openedurl wasn't set.
-rw-r--r--Lib/urllib.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 7b5ed6b..4186502 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -254,12 +254,13 @@ class URLopener:
# Use local file
def open_local_file(self, url):
host, file = splithost(url)
- if not host: return addinfourl(open(url2pathname(file), 'r'), noheaders(), self.openedurl)
+ if not host:
+ return addinfourl(open(url2pathname(file), 'r'), noheaders(), 'file:'+file)
host, port = splitport(host)
if not port and socket.gethostbyname(host) in (
localhost(), thishost()):
file = unquote(file)
- return addinfourl(open(url2pathname(file), 'r'), noheaders(), self.openedurl)
+ return addinfourl(open(url2pathname(file), 'r'), noheaders(), 'file:'+file)
raise IOError, ('local file error', 'not on local host')
# Use FTP protocol