summaryrefslogtreecommitdiffstats
path: root/test/modules
diff options
context:
space:
mode:
authorStefan Eissing <icing@apache.org>2022-10-21 09:39:49 +0200
committerStefan Eissing <icing@apache.org>2022-10-21 09:39:49 +0200
commitd4d25443cb12b5c84ff27e5c4f429c56a605362e (patch)
treebdf1808bf741f7e0d064bb8e0eae187d266ff2bc /test/modules
parenttests modules/http1: use "Header add" to produce response headers with whites... (diff)
downloadapache2-d4d25443cb12b5c84ff27e5c4f429c56a605362e.tar.xz
apache2-d4d25443cb12b5c84ff27e5c4f429c56a605362e.zip
*) test modules/http1: adding new invalid header values and testing also via h1 proxy.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1904756 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/modules')
-rw-r--r--test/modules/http1/env.py1
-rw-r--r--test/modules/http1/test_007_strict.py43
2 files changed, 35 insertions, 9 deletions
diff --git a/test/modules/http1/env.py b/test/modules/http1/env.py
index 55dfbe2683..5e395f31a8 100644
--- a/test/modules/http1/env.py
+++ b/test/modules/http1/env.py
@@ -63,6 +63,7 @@ class H1TestEnv(HttpdTestEnv):
self.httpd_error_log.set_ignored_lognos([
'AH00135', # unsafe/strict tests send invalid methods
+ 'AH02430', # test of invalid chars in response headers
])
self.httpd_error_log.add_ignored_patterns([
])
diff --git a/test/modules/http1/test_007_strict.py b/test/modules/http1/test_007_strict.py
index 78182419dc..784e77b9fd 100644
--- a/test/modules/http1/test_007_strict.py
+++ b/test/modules/http1/test_007_strict.py
@@ -68,30 +68,55 @@ class TestRequestStrict:
else:
assert int(m.group(1)) >= 400, f"{rlines}"
+ @pytest.mark.parametrize(["hvalue", "expvalue", "status"], [
+ ['"123"', '123', 200],
+ ['"123 "', '123 ', 200], # trailing space stays
+ ['"123\t"', '123\t', 200], # trailing tab stays
+ ['" 123"', '123', 200], # leading space is stripped
+ ['" 123"', '123', 200], # leading spaces are stripped
+ ['"\t123"', '123', 200], # leading tab is stripped
+ ['"expr=%{unescape:123%0A 123}"', '', 500], # illegal char
+ ])
+ def test_h1_007_02(self, env, hvalue, expvalue, status):
+ hname = 'ap-test-007'
+ conf = H1Conf(env, extras={
+ f'test1.{env.http_tld}': [
+ '<Location /index.html>',
+ f'Header add {hname} {hvalue}',
+ '</Location>',
+ ]
+ })
+ conf.add_vhost_test1(proxy_self=True)
+ conf.install()
+ assert env.apache_restart() == 0
+ url = env.mkurl("https", "test1", "/index.html")
+ r = env.curl_get(url, options=['--http1.1'])
+ assert r.response["status"] == status
+ if int(status) < 400:
+ assert r.response["header"][hname] == expvalue
+
@pytest.mark.parametrize(["hvalue", "expvalue"], [
['123', '123'],
- ['123 ', '123 '], # trailing space stays
- ['123\t', '123\t'], # trailing tab stays
+ ['123 ', '123'], # trailing space is stripped
+ ['123\t', '123'], # trailing tab is stripped
[' 123', '123'], # leading space is stripped
[' 123', '123'], # leading spaces are stripped
['\t123', '123'], # leading tab is stripped
])
- def test_h1_007_02(self, env, hvalue, expvalue):
+ def test_h1_007_03(self, env, hvalue, expvalue):
+ # same as 007_02, but http1 proxied
hname = 'ap-test-007'
conf = H1Conf(env, extras={
f'test1.{env.http_tld}': [
- '<Location />',
+ '<Location /index.html>',
f'Header add {hname} "{hvalue}"',
'</Location>',
]
})
- conf.add_vhost_test1(
- proxy_self=True
- )
+ conf.add_vhost_test1(proxy_self=True)
conf.install()
assert env.apache_restart() == 0
- url = env.mkurl("https", "test1", "/")
+ url = env.mkurl("https", "test1", "/proxy/index.html")
r = env.curl_get(url, options=['--http1.1'])
assert r.response["status"] == 200
assert r.response["header"][hname] == expvalue
-