From: Raymond Hettinger Date: Sun, 6 Oct 2002 03:24:29 +0000 (+0000) Subject: Backport 1.151 and 1.152: X-Git-Tag: v2.2.2b1~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5c6ab4a2dd183b5c1d7b1b14010ccaec560dff8b;p=thirdparty%2FPython%2Fcpython.git Backport 1.151 and 1.152: Treat file://localhost/ as local too (same as file:/ and file:///). Fixes #607789, bugfix candidate. --- diff --git a/Lib/urllib.py b/Lib/urllib.py index d30fbb9de5dc..5d23a3c96ba7 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -399,7 +399,7 @@ class URLopener: def open_file(self, url): """Use local file or FTP depending on form of URL.""" - if url[:2] == '//' and url[2:3] != '/': + if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/': return self.open_ftp(url) else: return self.open_local_file(url)