]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added tests for missing host to open_http and open_gopher
authorGuido van Rossum <guido@python.org>
Mon, 18 Apr 1994 09:39:56 +0000 (09:39 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 18 Apr 1994 09:39:56 +0000 (09:39 +0000)
Lib/urllib.py

index 7350de61e018d82a58eff1b9f20899ceb96aeaab..beabfc7ed57bf049f3cd3bd5c7de834cc893af4b 100644 (file)
@@ -132,6 +132,7 @@ class URLopener:
        def open_http(self, url):
                import httplib
                host, selector = splithost(url)
+               if not host: raise IOError, ('http error', 'no host given')
                h = httplib.HTTP(host)
                h.putrequest('GET', selector)
                for args in self.addheaders: apply(h.putheader, args)
@@ -143,6 +144,7 @@ class URLopener:
        def open_gopher(self, url):
                import gopherlib
                host, selector = splithost(url)
+               if not host: raise IOError, ('gopher error', 'no host given')
                type, selector = splitgophertype(selector)
                selector, query = splitquery(selector)
                if query: fp = gopherlib.send_query(selector, query, host)