]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
avoid crash in open_ftp when no host in url
authorGuido van Rossum <guido@python.org>
Fri, 4 Mar 1994 12:10:33 +0000 (12:10 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 4 Mar 1994 12:10:33 +0000 (12:10 +0000)
Lib/urlopen.py

index 0f3c33a88feb821fea2600f71d5af8fc862d674a..47f0f20424c35a616814bebdf63e8f789924d618 100755 (executable)
@@ -169,6 +169,7 @@ class URLopener:
        # 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: