summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httpservers.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-04-03 00:45:46 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-04-03 00:45:46 (GMT)
commitacc03195b0609490a4e5f8b1d9eb504c22c6526e (patch)
tree2ba86f93a5c19a7865088cf15c720867e21608aa /Lib/test/test_httpservers.py
parentaf8363926aa1cb96483a1777d478491e7415faff (diff)
downloadcpython-acc03195b0609490a4e5f8b1d9eb504c22c6526e.zip
cpython-acc03195b0609490a4e5f8b1d9eb504c22c6526e.tar.gz
cpython-acc03195b0609490a4e5f8b1d9eb504c22c6526e.tar.bz2
Issue #26586: Handle excessive header fields in http.server, by Xiang Zhang
Diffstat (limited to 'Lib/test/test_httpservers.py')
-rw-r--r--Lib/test/test_httpservers.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index d4c8eab..b71fa5e 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -858,6 +858,13 @@ class BaseHTTPRequestHandlerTestCase(unittest.TestCase):
self.assertFalse(self.handler.get_called)
self.assertEqual(self.handler.requestline, 'GET / HTTP/1.1')
+ def test_too_many_headers(self):
+ result = self.send_typical_request(
+ b'GET / HTTP/1.1\r\n' + b'X-Foo: bar\r\n' * 101 + b'\r\n')
+ self.assertEqual(result[0], b'HTTP/1.1 431 Too many headers\r\n')
+ self.assertFalse(self.handler.get_called)
+ self.assertEqual(self.handler.requestline, 'GET / HTTP/1.1')
+
def test_close_connection(self):
# handle_one_request() should be repeatedly called until
# it sets close_connection