You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2026/05/21 14:12:04 UTC

svn commit: r1934478 - httpd/httpd/trunk/test/modules/http2

Author: ichristod
Date: Thu May 21 14:12:04 2026
New Revision: 1934478

Log:
Adds test for missing header in h2 proxy.

covers the changes of r1927036 and r1927629.

Github: closes #620

Modified:
   httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py

Modified: httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py
==============================================================================
--- httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py	Thu May 21 13:15:57 2026	(r1934477)
+++ httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py	Thu May 21 14:12:04 2026	(r1934478)
@@ -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"])