Skip to content

Commit 2719415

Browse files
committed
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
1 parent 85d52a3 commit 2719415

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

test/modules/http2/test_600_h2proxy.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import pytest
2+
import re
3+
import socket
24

35
from .env import H2Conf, H2TestEnv
46

@@ -198,3 +200,27 @@ def test_h2_600_32(self, env, repeat):
198200
# stream (exit_code != 0) or give a 503 response.
199201
if r.exit_code == 0:
200202
assert r.response['status'] in [502, 503]
203+
204+
# test missing host header
205+
def test_h2_600_33(self, env):
206+
207+
conf = H2Conf(env, extras={
208+
'base': [
209+
'ProxyPreserveHost on',
210+
f'ProxyPass /test/ h2c://127.0.0.1:{env.http_port}/',
211+
],
212+
})
213+
conf.install()
214+
assert env.apache_restart() == 0
215+
216+
with socket.create_connection(
217+
('localhost', int(env.http_port))) as sock:
218+
sock.sendall("GET /test/\r\n\r\n".encode())
219+
warn_message = re.compile(
220+
r'.*HTTP/0\.9 request \(with no Host header\)'
221+
r' and preserve host set, forcing hostname.*'
222+
)
223+
assert env.httpd_error_log.scan_recent(warn_message, timeout=5)
224+
env.httpd_error_log.ignore_recent(matches=[
225+
r'.*HTTP/0\.9 request \(with no Host header\).*', ],
226+
lognos=["AH10511"])

0 commit comments

Comments
 (0)