avoid crash in open_ftp when no host in url

This commit is contained in:
Guido van Rossum 1994-03-04 12:10:33 +00:00
parent 5e334d9823
commit d66acb45f8
1 changed files with 1 additions and 0 deletions

View File

@ -169,6 +169,7 @@ def open_local_file(self, url):
# Use FTP protocol
def open_ftp(self, url):
host, file = splithost(url)
if not host: raise IOError, ('ftp error', 'no host given')
host, port = splitport(host)
host = socket.gethostbyname(host)
if not port: