Changeset 2041
- Timestamp:
- 09/27/08 16:04:45
- Files:
-
- trunk/cherrypy/test/test_http.py (modified) (1 diff)
- trunk/cherrypy/wsgiserver/__init__.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/test/test_http.py
r1915 r2041 104 104 response_body) 105 105 106 def test_malformed_request_line(self): 107 # Test missing version in Request-Line 108 if self.scheme == 'https': 109 c = httplib.HTTPSConnection('127.0.0.1:%s' % self.PORT) 110 else: 111 c = httplib.HTTPConnection('127.0.0.1:%s' % self.PORT) 112 c._output('GET /') 113 c._send_output() 114 response = c.response_class(c.sock, strict=c.strict, method='GET') 115 response.begin() 116 self.assertEqual(response.status, 400) 117 self.assertEqual(response.fp.read(), "Malformed Request-Line") 118 c.close() 119 106 120 107 121 if __name__ == '__main__': trunk/cherrypy/wsgiserver/__init__.py
r2038 r2041 333 333 environ = self.environ 334 334 335 method, path, req_protocol = request_line.strip().split(" ", 2) 335 try: 336 method, path, req_protocol = request_line.strip().split(" ", 2) 337 except ValueError: 338 self.simple_response(400, "Malformed Request-Line") 339 return 340 336 341 environ["REQUEST_METHOD"] = method 337 342 … … 589 594 if msg: 590 595 buf.append(msg) 591 self.wfile.sendall("".join(buf)) 596 597 try: 598 self.wfile.sendall("".join(buf)) 599 except socket.error, x: 600 if x.args[0] not in socket_errors_to_ignore: 601 raise 592 602 593 603 def start_response(self, status, headers, exc_info = None):

