diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2022-03-12 18:35:01 -0700 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2022-03-12 19:48:25 -0700 |
commit | 884bed167d09c3d5fdf0730e2ca2564eefdd4534 (patch) | |
tree | 027fa2896a20a289c5fe4c1ec5829a201c25979d | |
parent | 1f6059f4c4a3a0b256b4027eda64fb9fc311b0a6 (diff) | |
download | waitress-884bed167d09c3d5fdf0730e2ca2564eefdd4534.tar.gz |
Update tests to remove invalid chunked encoding chunk-size
RFC7230 states the following:
chunk = chunk-size [ chunk-ext ] CRLF
chunk-data CRLF
chunk-size = 1*HEXDIG
Where chunk-ext is:
chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
Only if there is a chunk-ext should there be a `;` after the 1*HEXDIG.
And a chunk-ext that is empty is invalid.
-rw-r--r-- | tests/test_functional.py | 6 | ||||
-rw-r--r-- | tests/test_parser.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_functional.py b/tests/test_functional.py index f74a252..d1366ca 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -322,7 +322,7 @@ class EchoTests: self.assertFalse("transfer-encoding" in headers) def test_chunking_request_with_content(self): - control_line = b"20;\r\n" # 20 hex = 32 dec + control_line = b"20\r\n" # 20 hex = 32 dec s = b"This string has 32 characters.\r\n" expected = s * 12 header = b"GET / HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n" @@ -341,7 +341,7 @@ class EchoTests: self.assertFalse("transfer-encoding" in headers) def test_broken_chunked_encoding(self): - control_line = b"20;\r\n" # 20 hex = 32 dec + control_line = b"20\r\n" # 20 hex = 32 dec s = b"This string has 32 characters.\r\n" to_send = b"GET / HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n" to_send += control_line + s + b"\r\n" @@ -365,7 +365,7 @@ class EchoTests: self.assertRaises(ConnectionClosed, read_http, fp) def test_broken_chunked_encoding_missing_chunk_end(self): - control_line = b"20;\r\n" # 20 hex = 32 dec + control_line = b"20\r\n" # 20 hex = 32 dec s = b"This string has 32 characters.\r\n" to_send = b"GET / HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n" to_send += control_line + s diff --git a/tests/test_parser.py b/tests/test_parser.py index 868c122..4461bde 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -155,7 +155,7 @@ class TestHTTPRequestParser(unittest.TestCase): b"Transfer-Encoding: chunked\r\n" b"X-Foo: 1\r\n" b"\r\n" - b"1d;\r\n" + b"1d\r\n" b"This string has 29 characters\r\n" b"0\r\n\r\n" ) |