mirror of https://github.com/python/cpython.git
avoid crash in open_ftp when no host in url
This commit is contained in:
parent
5e334d9823
commit
d66acb45f8
|
@ -169,6 +169,7 @@ def open_local_file(self, url):
|
||||||
# Use FTP protocol
|
# Use FTP protocol
|
||||||
def open_ftp(self, url):
|
def open_ftp(self, url):
|
||||||
host, file = splithost(url)
|
host, file = splithost(url)
|
||||||
|
if not host: raise IOError, ('ftp error', 'no host given')
|
||||||
host, port = splitport(host)
|
host, port = splitport(host)
|
||||||
host = socket.gethostbyname(host)
|
host = socket.gethostbyname(host)
|
||||||
if not port:
|
if not port:
|
||||||
|
|
Loading…
Reference in New Issue