Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changes-entries/pr70295.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*) mod_remote_ip: Fix REMOTE_PORT in expressions and environment variables.
*) core: Fix REMOTE_PORT in expressions and environment variables.
PR 70295. [Steve Bennett <S.Bennett lancaster.ac.uk>]
41 changes: 41 additions & 0 deletions test/modules/core/test_013_expr_proto_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import pytest

from pyhttpd.backport import not_backported
from pyhttpd.conf import HttpdConf

pytestmark = not_backported("r1410755",
"SERVER_PROTOCOL_VERSION ap_expr variables",
backported_in="2.4.72")


# The variables do not parse on a server without them, so the restart
# status is checked by each test rather than here.
@pytest.fixture(scope='module')
def restart_rc(env):
conf = HttpdConf(env, extras={
'base': """
ErrorDocument 404 "v=%{SERVER_PROTOCOL_VERSION} major=%{SERVER_PROTOCOL_VERSION_MAJOR} minor=%{SERVER_PROTOCOL_VERSION_MINOR}"
"""
})
conf.add_vhost_test1()
conf.install()
return env.apache_restart()


class TestExprProtoVersion:

def get(self, env, restart_rc, options):
assert restart_rc == 0
r = env.curl_get(env.mkurl("http", "test1", "/no-such-file"),
options=options)
assert r.response, f"no response: {r.stderr}"
assert r.response["status"] == 404
return r.response["body"].decode().strip()

def test_core_013_01_http11(self, env, restart_rc):
assert self.get(env, restart_rc, ['--http1.1']) == \
"v=1001 major=1 minor=1"

def test_core_013_02_http10(self, env, restart_rc):
assert self.get(env, restart_rc, ['--http1.0']) == \
"v=1000 major=1 minor=0"
Loading