Commit 1f07c139 authored by Guido van Rossum's avatar Guido van Rossum

Fix some cases where self.openedurl wasn't set.

parent 6acf301f
...@@ -254,12 +254,13 @@ class URLopener: ...@@ -254,12 +254,13 @@ class URLopener:
# Use local file # Use local file
def open_local_file(self, url): def open_local_file(self, url):
host, file = splithost(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) host, port = splitport(host)
if not port and socket.gethostbyname(host) in ( if not port and socket.gethostbyname(host) in (
localhost(), thishost()): localhost(), thishost()):
file = unquote(file) 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') raise IOError, ('local file error', 'not on local host')
# Use FTP protocol # Use FTP protocol
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment