Kaydet (Commit) b030bc02 authored tarafından Guido van Rossum's avatar Guido van Rossum

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

üst b5fa1cb8
......@@ -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
......
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