]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 1.151 and 1.152:
authorRaymond Hettinger <python@rcn.com>
Sun, 6 Oct 2002 03:24:29 +0000 (03:24 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 6 Oct 2002 03:24:29 +0000 (03:24 +0000)
Treat file://localhost/ as local too (same as file:/ and file:///).
Fixes #607789, bugfix candidate.

Lib/urllib.py

index d30fbb9de5dc4e79d513c4f09f58481756bf384a..5d23a3c96ba7bc25b4ac10185605da1166726516 100644 (file)
@@ -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)