Commit 590b2896 authored by Guido van Rossum's avatar Guido van Rossum

Added tests for missing host to open_http and open_gopher

parent e531e4b0
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment