From: Guido van Rossum Date: Mon, 18 Apr 1994 09:39:56 +0000 (+0000) Subject: Added tests for missing host to open_http and open_gopher X-Git-Tag: v1.0.2~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=590b289672f340f2d122c6d75f195949213974e8;p=thirdparty%2FPython%2Fcpython.git Added tests for missing host to open_http and open_gopher --- diff --git a/Lib/urllib.py b/Lib/urllib.py index 7350de61e018..beabfc7ed57b 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -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)