From: Roey Berman Date: Wed, 15 Aug 2012 11:15:31 +0000 (+0300) Subject: ignore 1xx headers prev commit was incomplete, fixed X-Git-Tag: v2.4.0~26^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=954777f35351ea93b2413281495a704c460bfba0;p=thirdparty%2Ftornado.git ignore 1xx headers prev commit was incomplete, fixed --- diff --git a/tornado/simple_httpclient.py b/tornado/simple_httpclient.py index 3a81465e5..e45ddf0cd 100644 --- a/tornado/simple_httpclient.py +++ b/tornado/simple_httpclient.py @@ -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) diff --git a/tornado/test/simple_httpclient_test.py b/tornado/test/simple_httpclient_test.py index 5cfffc514..fac7803f1 100644 --- a/tornado/test/simple_httpclient_test.py +++ b/tornado/test/simple_httpclient_test.py @@ -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)