Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d66acb4

Browse files
committed
avoid crash in open_ftp when no host in url
1 parent 5e334d9 commit d66acb4

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Lib/urlopen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def open_local_file(self, url):
169169
# Use FTP protocol
170170
def open_ftp(self, url):
171171
host, file = splithost(url)
172+
if not host: raise IOError, ('ftp error', 'no host given')
172173
host, port = splitport(host)
173174
host = socket.gethostbyname(host)
174175
if not port:

0 commit comments

Comments
 (0)