summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Eissing <icing@apache.org>2024-11-07 13:02:41 +0100
committerStefan Eissing <icing@apache.org>2024-11-07 13:02:41 +0100
commitd94933b89f6cea18ccdda868d6bd81a5811385fc (patch)
tree157112f5108e09174ad71f4230e7056b2489b202 /test
parentfr doc rebuild. (diff)
downloadapache2-d94933b89f6cea18ccdda868d6bd81a5811385fc.tar.xz
apache2-d94933b89f6cea18ccdda868d6bd81a5811385fc.zip
mod_http2, fix keepalive timeout on reset requests
Count failed requests that are RST'ed, so that the connection enters keepalive timeout instead of the regular timeout if the first request fails. Add tests to verify. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1921805 13f79535-47bb-0310-9956-ffa450edef68
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
+