From 2ef16328e82ae9b9715251e41b8abf4b95ae6f20 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Sun, 11 Jul 2010 03:12:43 +0000 Subject: Stricter verification for file based url scheme and reliance on ftp protocol. --- Lib/urllib/request.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib/urllib/request.py') diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index f7c7416f34..c6767d0b26 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1188,7 +1188,8 @@ class FileHandler(BaseHandler): # Use local file or FTP depending on form of URL def file_open(self, req): url = req.selector - if url[:2] == '//' and url[2:3] != '/': + if url[:2] == '//' and url[2:3] != '/' and (req.host and + req.host != 'localhost'): req.type = 'ftp' return self.parent.open(req) else: -- cgit v1.2.1