From: Ben Darnell Date: Mon, 7 Feb 2011 02:42:04 +0000 (-0800) Subject: Add a test to verify reasonable behavior when HTTPS server is sent non-SSL request. X-Git-Tag: v1.2.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ff8535de7cd455037119386937dc4ec5d3b3c83;p=thirdparty%2Ftornado.git Add a test to verify reasonable behavior when HTTPS server is sent non-SSL request. Prompted by issue #211. --- diff --git a/tornado/test/httpserver_test.py b/tornado/test/httpserver_test.py index 687cd07f1..b107578e7 100644 --- a/tornado/test/httpserver_test.py +++ b/tornado/test/httpserver_test.py @@ -56,6 +56,16 @@ class SSLTest(AsyncHTTPTestCase, LogTrapTestCase): body='A'*5000) self.assertEqual(response.body, "Got 5000 bytes in POST") + def test_non_ssl_request(self): + # Make sure the server closes the connection when it gets a non-ssl + # connection, rather than waiting for a timeout or otherwise + # misbehaving. + self.http_client.fetch(self.get_url("/"), self.stop, + request_timeout=3600, + connect_timeout=3600) + response = self.wait() + self.assertEqual(response.code, 599) + if (ssl is None or pycurl is None or (pycurl.version_info()[5].startswith('GnuTLS') and pycurl.version_info()[2] < 0x71400)):