summaryrefslogtreecommitdiff
path: root/cherrypy/test/test_http.py
diff options
context:
space:
mode:
authorRobert Brewer <fumanchu@aminus.org>2008-09-27 21:04:45 +0000
committerRobert Brewer <fumanchu@aminus.org>2008-09-27 21:04:45 +0000
commit2492d70c638453e8f67240d7e4bc547188bd7dd4 (patch)
treeac13ea3465f7d3ffaf3bf30d825fde6e00b93056 /cherrypy/test/test_http.py
parentfa6f7b1c329e2b9e8b2be9fb50fa4f8c821362d8 (diff)
downloadcherrypy-git-2492d70c638453e8f67240d7e4bc547188bd7dd4.tar.gz
Fix for #851 (malformed get request to wsgiserver results in traceback).
Diffstat (limited to 'cherrypy/test/test_http.py')
-rw-r--r--cherrypy/test/test_http.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/cherrypy/test/test_http.py b/cherrypy/test/test_http.py
index bc61d60b..8d8288fc 100644
--- a/cherrypy/test/test_http.py
+++ b/cherrypy/test/test_http.py
@@ -103,6 +103,20 @@ class HTTPTests(helper.CPWebCase):
self.assertEquals(", ".join(["%s * 65536" % c for c in alphabet]),
response_body)
+ def test_malformed_request_line(self):
+ # Test missing version in Request-Line
+ if self.scheme == 'https':
+ c = httplib.HTTPSConnection('127.0.0.1:%s' % self.PORT)
+ else:
+ c = httplib.HTTPConnection('127.0.0.1:%s' % self.PORT)
+ c._output('GET /')
+ c._send_output()
+ response = c.response_class(c.sock, strict=c.strict, method='GET')
+ response.begin()
+ self.assertEqual(response.status, 400)
+ self.assertEqual(response.fp.read(), "Malformed Request-Line")
+ c.close()
+
if __name__ == '__main__':
setup_server()