Skip to content

Commit e0497f9

Browse files
committed
Fix perfect match missed for headers with empty values: add test and changelog
1 parent 89cce96 commit e0497f9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dev
1717
**Bugfixes**
1818

1919
- Headers marked as `sensitive` will no longer log their value at DEBUG level. Instead a placeholder value of `SENSITIVE_REDACTED` is logged.
20+
- Fixed perfect match missed for headers with empty values.
2021

2122
4.1.0 (2025-01-22)
2223
------------------

tests/test_hpack.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ def test_indexed_header_field(self):
126126
assert e.encode(header_set, huffman=False) == result
127127
assert list(e.header_table.dynamic_entries) == []
128128

129+
def test_indexed_header_field_empty_value_string(self):
130+
"""
131+
The header field representation uses an indexed header field, from
132+
the static table.
133+
"""
134+
e = Encoder()
135+
header_set = {':authority': ''}
136+
result = b'\x81'
137+
138+
assert e.encode(header_set, huffman=False) == result
139+
assert list(e.header_table.dynamic_entries) == []
140+
129141
def test_indexed_header_field_from_static_table(self):
130142
e = Encoder()
131143
e.header_table_size = 0

0 commit comments

Comments
 (0)