summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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