]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
ignore 1xx headers prev commit was incomplete, fixed
authorRoey Berman <roey.berman@gmail.com>
Wed, 15 Aug 2012 11:15:31 +0000 (14:15 +0300)
committerRoey Berman <roey.berman@gmail.com>
Wed, 15 Aug 2012 11:15:31 +0000 (14:15 +0300)
tornado/simple_httpclient.py
tornado/test/simple_httpclient_test.py

index 3a81465e58a568b79797fcf2a3d19ffb81c06663..e45ddf0cde94b0c0b6bc41b31c3b1a1044b7c86d 100644 (file)
@@ -336,11 +336,11 @@ class _HTTPConnection(object):
         match = re.match("HTTP/1.[01] ([0-9]+)", first_line)
         assert match
         code = int(match.group(1))
-        if code != 100:
-            self.code = code
-        else:
+        if 100 <= code < 200:
             self.stream.read_until_regex(b("\r?\n\r?\n"), self._on_headers)
             return
+        else:
+            self.code = code
 
         self.headers = HTTPHeaders.parse(header_data)
 
index 5cfffc514156760a6786cfd608e8f80b73635ff2..fac7803f1e4d363ffa6871c450c8d33f6a241f45 100644 (file)
@@ -284,17 +284,15 @@ class SimpleHTTPClientTestCase(AsyncHTTPTestCase, LogTrapTestCase):
         self.assertTrue(host_re.match(response.body), response.body)
 
 
-class SaveAsyncHTTPClientConfigurationTestCase(AsyncTestCase, LogTrapTestCase):
+class CreateAsyncHTTPClientTestCase(AsyncTestCase, LogTrapTestCase):
     def setUp(self):
-        super(SaveAsyncHTTPClientConfigurationTestCase, self).setUp()
+        super(CreateAsyncHTTPClientTestCase, self).setUp()
         self.saved = AsyncHTTPClient._save_configuration()
 
     def tearDown(self):
         AsyncHTTPClient._restore_configuration(self.saved)
-        super(SaveAsyncHTTPClientConfigurationTestCase, self).tearDown()
+        super(CreateAsyncHTTPClientTestCase, self).tearDown()
 
-
-class CreateAsyncHTTPClientTestCase(SaveAsyncHTTPClientConfigurationTestCase):
     def test_max_clients(self):
         # The max_clients argument is tricky because it was originally
         # allowed to be passed positionally; newer arguments are keyword-only.
@@ -323,7 +321,7 @@ class CreateAsyncHTTPClientTestCase(SaveAsyncHTTPClientConfigurationTestCase):
             self.assertEqual(client.max_clients, 14)
 
 
-class HTTP100ContinueTestCase(SaveAsyncHTTPClientConfigurationTestCase):
+class HTTP100ContinueTestCase(AsyncTestCase, LogTrapTestCase):
     def respond_100(self, request):
         self.request = request
         self.request.connection.stream.write("HTTP/1.1 100 CONTINUE\r\n\r\n", self.respond_200)