summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/modules/http2/test_200_header_invalid.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/modules/http2/test_200_header_invalid.py b/test/modules/http2/test_200_header_invalid.py
index 04c022c362..cbc4b6c9fa 100644
--- a/test/modules/http2/test_200_header_invalid.py
+++ b/test/modules/http2/test_200_header_invalid.py
@@ -1,3 +1,4 @@
+import re
import pytest
from .env import H2Conf, H2TestEnv
@@ -227,3 +228,57 @@ class TestInvalidHeaders:
r = env.nghttp().get(url, options=opt)
assert r.exit_code == 0, r
assert r.response is None
+
+ # test few failed headers, should
+ def test_h2_200_17(self, env):
+ url = env.mkurl("https", "cgi", "/")
+
+ # test few failed headers, should give response
+ def test_h2_200_17(self, env):
+ conf = H2Conf(env)
+ conf.add("""
+ LimitRequestFieldSize 20
+ LogLevel http2:debug
+ """)
+ conf.add_vhost_cgi()
+ conf.install()
+ assert env.apache_restart() == 0
+ re_emitted = re.compile(r'.* AH03401: .* shutdown, remote.emitted=1')
+ url = env.mkurl("https", "cgi", "/")
+ opt = []
+ for i in range(10):
+ opt += ["-H", f"x{i}: 012345678901234567890123456789"]
+ r = env.curl_get(url, options=opt)
+ assert r.response
+ assert r.response["status"] == 431
+ assert env.httpd_error_log.scan_recent(re_emitted)
+
+ # test too many failed headers, should give RST
+ def test_h2_200_18(self, env):
+ conf = H2Conf(env)
+ conf.add("""
+ LimitRequestFieldSize 20
+ LogLevel http2:debug
+ """)
+ conf.add_vhost_cgi()
+ conf.install()
+ assert env.apache_restart() == 0
+ re_emitted = re.compile(r'.* AH03401: .* shutdown, remote.emitted=1')
+ url = env.mkurl("https", "cgi", "/")
+ opt = []
+ for i in range(100):
+ opt += ["-H", f"x{i}: 012345678901234567890123456789"]
+ r = env.curl_get(url, options=opt)
+ assert r.response is None
+ assert env.httpd_error_log.scan_recent(re_emitted)
+
+ # test header 10 invalid headers, should trigger stream RST
+ def test_h2_200_19(self, env):
+ url = env.mkurl("https", "cgi", "/")
+ opt = []
+ invalid = '\x7f'
+ for i in range(10):
+ opt += ["-H", f"x{i}: {invalid}"]
+ r = env.curl_get(url, options=opt)
+ assert r.response is None
+