diff options
| author | Ryan Williams <breath@alum.mit.edu> | 2010-08-11 16:46:42 -0700 |
|---|---|---|
| committer | Ryan Williams <breath@alum.mit.edu> | 2010-08-11 16:46:42 -0700 |
| commit | 102256f293f2c834771dfb3642bb55307c8e5a76 (patch) | |
| tree | 7877bf7019495e114f3697c0c48271631b6b2c02 /tests/wsgi_test.py | |
| parent | f87099e1b9effe4dd10c3809a6a091d73dc8205c (diff) | |
| download | eventlet-102256f293f2c834771dfb3642bb55307c8e5a76.tar.gz | |
Ensure that when an exception is raised in the application the server doesn't use a chunked response and closes the connection.
Diffstat (limited to 'tests/wsgi_test.py')
| -rw-r--r-- | tests/wsgi_test.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/wsgi_test.py b/tests/wsgi_test.py index e4046e4..438f61d 100644 --- a/tests/wsgi_test.py +++ b/tests/wsgi_test.py @@ -924,6 +924,20 @@ class TestHttpd(_TestBase): self.assertEqual(read_content.wait(), 'ok') self.assert_(blew_up[0]) + def test_exceptions_close_connection(self): + def wsgi_app(environ, start_response): + raise RuntimeError("intentional error") + self.site.application = wsgi_app + sock = eventlet.connect(('localhost', self.port)) + fd = sock.makefile('rw') + fd.write('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') + fd.flush() + response_line, headers, body = read_http(sock) + self.assert_(response_line.startswith('HTTP/1.1 500 Internal Server Error')) + self.assertEqual(headers['connection'], 'close') + self.assert_('transfer-encoding' not in headers) + + def read_headers(sock): fd = sock.makefile() try: |
