From 17b3786186dfdffdc2d4384ca1a1f5cd92489950 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Mon, 26 Jan 2026 11:14:22 +0100 Subject: [PATCH] Update test to expect :authority override per RFC 9113 --- tests/test_http2_request.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_http2_request.py b/tests/test_http2_request.py index 6c71b813..cf21b15c 100644 --- a/tests/test_http2_request.py +++ b/tests/test_http2_request.py @@ -259,8 +259,8 @@ class TestHTTP2Request: host = req.get_header('HOST') assert host == 'test.example.com:8080' - def test_existing_host_header_not_duplicated(self): - """If Host header exists, don't add from :authority.""" + def test_authority_overrides_host_header(self): + """:authority MUST override Host header per RFC 9113 section 8.3.1.""" stream = self._make_stream([ (':method', 'GET'), (':path', '/'), @@ -271,10 +271,10 @@ class TestHTTP2Request: cfg = MockConfig() req = HTTP2Request(stream, cfg, ('127.0.0.1', 12345)) - # Count HOST headers + # Count HOST headers - should be exactly one, from :authority host_headers = [h for h in req.headers if h[0] == 'HOST'] assert len(host_headers) == 1 - assert host_headers[0][1] == 'explicit.example.com' + assert host_headers[0][1] == 'authority.example.com' def test_get_header_case_insensitive(self): stream = self._make_stream([