From: Giannis Christodoulou Date: Thu, 21 May 2026 14:12:04 +0000 (+0000) Subject: Adds test for missing header in h2 proxy. X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=2719415676bcce9cf8faeec00f1436b18ca6dcca;p=thirdparty%2Fapache%2Fhttpd.git Adds test for missing header in h2 proxy. covers the changes of r1927036 and r1927629. Github: closes #620 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934478 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/modules/http2/test_600_h2proxy.py b/test/modules/http2/test_600_h2proxy.py index 0f69ea741d..7e43652eb2 100644 --- a/test/modules/http2/test_600_h2proxy.py +++ b/test/modules/http2/test_600_h2proxy.py @@ -1,4 +1,6 @@ import pytest +import re +import socket from .env import H2Conf, H2TestEnv @@ -198,3 +200,27 @@ class TestH2Proxy: # stream (exit_code != 0) or give a 503 response. if r.exit_code == 0: assert r.response['status'] in [502, 503] + + # test missing host header + def test_h2_600_33(self, env): + + conf = H2Conf(env, extras={ + 'base': [ + 'ProxyPreserveHost on', + f'ProxyPass /test/ h2c://127.0.0.1:{env.http_port}/', + ], + }) + conf.install() + assert env.apache_restart() == 0 + + with socket.create_connection( + ('localhost', int(env.http_port))) as sock: + sock.sendall("GET /test/\r\n\r\n".encode()) + warn_message = re.compile( + r'.*HTTP/0\.9 request \(with no Host header\)' + r' and preserve host set, forcing hostname.*' + ) + assert env.httpd_error_log.scan_recent(warn_message, timeout=5) + env.httpd_error_log.ignore_recent(matches=[ + r'.*HTTP/0\.9 request \(with no Host header\).*', ], + lognos=["AH10511"])