From: daftshady Date: Sun, 15 May 2016 14:02:43 +0000 (+0900) Subject: Add invalid content-length testcase X-Git-Tag: v4.4.0b1~15^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1aa5a5bc9afae299527316b39c91150907678707;p=thirdparty%2Ftornado.git Add invalid content-length testcase --- diff --git a/tornado/test/httpserver_test.py b/tornado/test/httpserver_test.py index 900c2c354..d1b5a2435 100644 --- a/tornado/test/httpserver_test.py +++ b/tornado/test/httpserver_test.py @@ -441,6 +441,18 @@ bar headers, response = self.wait() self.assertEqual(json_decode(response), {u'foo': [u'bar']}) + def test_invalid_content_length(self): + with ExpectLog(gen_log, '.*Only integer Content-Length is allowed'): + self.stream.write(b"""\ +POST /echo HTTP/1.1 +Content-Length: foo + +bar + +""".replace(b"\n", b"\r\n")) + self.io_loop.add_timeout(datetime.timedelta(seconds=0.01), self.stop) + self.wait() + class XHeaderTest(HandlerBaseTestCase): class Handler(RequestHandler):