diff options
author | Georg Brandl <georg@python.org> | 2014-09-30 12:56:46 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-09-30 12:56:46 (GMT) |
commit | 860c367c29eb557930099a7cc7fe297a259275f6 (patch) | |
tree | f1b368e97e9ca6d9be8fd55872d46a0e65627456 /Lib/test | |
parent | 21bf3f942be920f3b051f6af43f7c37b9aa5cff3 (diff) | |
download | cpython-860c367c29eb557930099a7cc7fe297a259275f6.zip cpython-860c367c29eb557930099a7cc7fe297a259275f6.tar.gz cpython-860c367c29eb557930099a7cc7fe297a259275f6.tar.bz2 |
Issue #22419: Limit the length of incoming HTTP request in wsgiref server to
65536 bytes and send a 414 error code for higher lengths. Patch contributed
by Devin Cook.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_wsgiref.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py index 08f8d9a..c0bfaa8 100644 --- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -114,6 +114,11 @@ class IntegrationTests(TestCase): out, err = run_amock() self.check_hello(out) + def test_request_length(self): + out, err = run_amock(data=b"GET " + (b"x" * 65537) + b" HTTP/1.0\n\n") + self.assertEqual(out.splitlines()[0], + b"HTTP/1.0 414 Request-URI Too Long") + def test_validated_hello(self): out, err = run_amock(validator(hello_app)) # the middleware doesn't support len(), so content-length isn't there |