diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-10-14 11:57:35 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-10-14 11:57:35 (GMT) |
commit | 383c32dd3821828f271c0bf7bcf21f0ba71792e8 (patch) | |
tree | af0d55d8de4b60bfb1a4ce993a29b7387eb136b8 /Lib/urllib | |
parent | 6d7be5f86cf9eca0ab6f4c53b834e48f81ed6291 (diff) | |
download | cpython-383c32dd3821828f271c0bf7bcf21f0ba71792e8.zip cpython-383c32dd3821828f271c0bf7bcf21f0ba71792e8.tar.gz cpython-383c32dd3821828f271c0bf7bcf21f0ba71792e8.tar.bz2 |
Issue10063 - file:// scheme will stop accessing remote hosts via ftp protocol
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/request.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index e2845c9..9674b96 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1228,8 +1228,8 @@ class FileHandler(BaseHandler): url = req.selector if url[:2] == '//' and url[2:3] != '/' and (req.host and req.host != 'localhost'): - req.type = 'ftp' - return self.parent.open(req) + if not req.host is self.get_names(): + raise URLError("file:// scheme is supported only on localhost") else: return self.open_local_file(req) @@ -1712,7 +1712,7 @@ class URLopener: if not isinstance(url, str): raise URLError('file error', 'proxy support for file protocol currently not implemented') if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/': - return self.open_ftp(url) + raise ValueError("file:// scheme is supported only on localhost") else: return self.open_local_file(url) |