summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-04-18 09:39:56 (GMT)
committerGuido van Rossum <guido@python.org>1994-04-18 09:39:56 (GMT)
commit590b289672f340f2d122c6d75f195949213974e8 (patch)
tree376492268b6a65c9a0b87d2c421ad3314bd46a87 /Lib
parente531e4b042c12fa2468a1bb0cd7dd0a9c3e10294 (diff)
downloadcpython-590b289672f340f2d122c6d75f195949213974e8.zip
cpython-590b289672f340f2d122c6d75f195949213974e8.tar.gz
cpython-590b289672f340f2d122c6d75f195949213974e8.tar.bz2
Added tests for missing host to open_http and open_gopher
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 7350de6..beabfc7 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)