From b030bc026eb57861568fdc9310512185c95a6f11 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 10 Oct 1996 16:01:16 +0000 Subject: [PATCH] Fix some cases where self.openedurl wasn't set. --- Lib/urllib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/urllib.py b/Lib/urllib.py index 7b5ed6b3594..418650253b8 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