mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue10063 - file:// scheme will stop accessing remote hosts via ftp protocol
This commit is contained in:
parent
6d7be5f86c
commit
383c32dd38
4 changed files with 17 additions and 7 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue