]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add a test to verify reasonable behavior when HTTPS server is sent non-SSL request.
authorBen Darnell <ben@bendarnell.com>
Mon, 7 Feb 2011 02:42:04 +0000 (18:42 -0800)
committerBen Darnell <ben@bendarnell.com>
Mon, 7 Feb 2011 02:42:04 +0000 (18:42 -0800)
Prompted by issue #211.

tornado/test/httpserver_test.py

index 687cd07f182b449fd58083b4e01d0d4c4278e8f2..b107578e75a2425f7fb8d68bafe6f1ac3747339e 100644 (file)
@@ -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)):