diff --git a/changes-entries/pr70295.txt b/changes-entries/pr70295.txt index 7d3c73758b3..b9a24f78e5e 100644 --- a/changes-entries/pr70295.txt +++ b/changes-entries/pr70295.txt @@ -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 ] diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml index 89e1a46f0b9..250f74046d2 100644 --- a/docs/manual/expr.xml +++ b/docs/manual/expr.xml @@ -719,7 +719,7 @@ DIGIT ::= <any US-ASCII digit "0".."9"> SERVER_PROTOCOL_VERSION_MAJOR and SERVER_PROTOCOL_VERSION_MINOR variables - are available for versions 2.5.0 and later.

+ are available for versions 2.4.71 and later.

diff --git a/test/modules/core/test_013_expr_proto_version.py b/test/modules/core/test_013_expr_proto_version.py new file mode 100644 index 00000000000..aa57e8f1261 --- /dev/null +++ b/test/modules/core/test_013_expr_proto_version.py @@ -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.71") + + +# 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" diff --git a/test/modules/metadata/test_004_remoteip.py b/test/modules/metadata/test_004_remoteip.py index 8afca7784c7..dfc8a3aab68 100644 --- a/test/modules/metadata/test_004_remoteip.py +++ b/test/modules/metadata/test_004_remoteip.py @@ -245,7 +245,8 @@ def test_metadata_004_06(self, env): # wherever a configuration asks for it: the REMOTE_PORT variable of # ap_expr (here via mod_headers) and the CGI/SSI REMOTE_PORT variable # (here via mod_include). Bug 70295. - REMOTE_PORT_FIX = not_backported("gh-896", "REMOTE_PORT from the useragent address") + REMOTE_PORT_FIX = not_backported("gh-896", "REMOTE_PORT from the useragent address", + backported_in="2.4.71") def remote_port_install(self, env): """A PROXY protocol vhost on http_port2 and an X-Forwarded-For one