Skip to content

Commit 07f8d6c

Browse files
committed
* test/modules/core: Adds test for disabled note option in
RequestHeader Submitted by: Giannis Christodoulou <io.xristod gmail.com> Github: closes #594 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1931424 13f79535-47bb-0310-9956-ffa450edef68
1 parent a261a61 commit 07f8d6c

4 files changed

Lines changed: 49 additions & 1 deletion

File tree

test/modules/core/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CoreTestSetup(HttpdTestSetup):
1212
def __init__(self, env: 'HttpdTestEnv'):
1313
super().__init__(env=env)
1414
self.add_source_dir(os.path.dirname(inspect.getfile(CoreTestSetup)))
15-
self.add_modules(["cgid","include"])
15+
self.add_modules(["cgid","include","userdir","suexec","headers"])
1616

1717

1818
class CoreTestEnv(HttpdTestEnv):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RequestHeader note internal_note "empty_note"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
echo "Content-Type: text/plain"
3+
echo
4+
echo "OK"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import os
2+
import re
3+
import pytest
4+
5+
from pyhttpd.conf import HttpdConf
6+
7+
class TestUserdirHeaders:
8+
9+
@pytest.fixture(autouse=True, scope='class')
10+
def _class_scope(self, env):
11+
12+
userdir_base = os.path.join(env.server_dir, "htdocs", "userdir")
13+
14+
conf = HttpdConf(env, extras={
15+
'base': f"""
16+
UserDir "{userdir_base}/*/public_html"
17+
18+
<Directory "{userdir_base}/*/public_html">
19+
AllowOverride FileInfo
20+
Options +ExecCGI
21+
SetHandler cgi-script
22+
</Directory>
23+
"""
24+
})
25+
conf.add_vhost_test1()
26+
conf.install()
27+
assert env.apache_restart() == 0
28+
29+
def test_core_005_01_requestheader_note_rejected(self, env):
30+
url = env.mkurl("http", "test1", "/~testuser/cgi-bin/test.cgi")
31+
r = env.curl_get(url)
32+
33+
# Check error log for the rejection message
34+
re_rejection = re.compile(r".*RequestHeader does not support the 'note' action.*")
35+
36+
directive_rejected = False
37+
try:
38+
directive_rejected = env.httpd_error_log.scan_recent(re_rejection)
39+
except TimeoutError:
40+
pass
41+
42+
assert directive_rejected, \
43+
"RequestHeader note directive was not rejected"

0 commit comments

Comments
 (0)