mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-05 20:21:34 +08:00
Update test to expect :authority override per RFC 9113
This commit is contained in:
parent
66d0880c74
commit
17b3786186
@ -259,8 +259,8 @@ class TestHTTP2Request:
|
|||||||
host = req.get_header('HOST')
|
host = req.get_header('HOST')
|
||||||
assert host == 'test.example.com:8080'
|
assert host == 'test.example.com:8080'
|
||||||
|
|
||||||
def test_existing_host_header_not_duplicated(self):
|
def test_authority_overrides_host_header(self):
|
||||||
"""If Host header exists, don't add from :authority."""
|
""":authority MUST override Host header per RFC 9113 section 8.3.1."""
|
||||||
stream = self._make_stream([
|
stream = self._make_stream([
|
||||||
(':method', 'GET'),
|
(':method', 'GET'),
|
||||||
(':path', '/'),
|
(':path', '/'),
|
||||||
@ -271,10 +271,10 @@ class TestHTTP2Request:
|
|||||||
cfg = MockConfig()
|
cfg = MockConfig()
|
||||||
req = HTTP2Request(stream, cfg, ('127.0.0.1', 12345))
|
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']
|
host_headers = [h for h in req.headers if h[0] == 'HOST']
|
||||||
assert len(host_headers) == 1
|
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):
|
def test_get_header_case_insensitive(self):
|
||||||
stream = self._make_stream([
|
stream = self._make_stream([
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user