]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Adds test for missing header in h2 proxy.
authorGiannis Christodoulou <ichristod@apache.org>
Thu, 21 May 2026 14:12:04 +0000 (14:12 +0000)
committerGiannis Christodoulou <ichristod@apache.org>
Thu, 21 May 2026 14:12:04 +0000 (14:12 +0000)
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

test/modules/http2/test_600_h2proxy.py

index 0f69ea741d0c1a186e102067cbb6ad14d3c5912b..7e43652eb2bac2dfb6b2951b472762e85488004a 100644 (file)
@@ -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"])