Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dev

- Support for Python 3.14 has been added.
- Support for PyPy 3.11 has been added.
- Fixed perfect match missed for headers with empty values


**Bugfixes**
Expand Down
2 changes: 1 addition & 1 deletion src/hpack/hpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def add(self, to_add: tuple[bytes, bytes], sensitive: bool, huffman: bool = Fals
# can use the indexed literal.
index, name, perfect = match

if perfect:
if perfect is not None:
# Indexed representation.
encoded = self._encode_indexed(index)
else:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_hpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ def test_indexed_header_field(self):
assert e.encode(header_set, huffman=False) == result
assert list(e.header_table.dynamic_entries) == []

def test_indexed_header_field_empty_value_string(self):
"""
The header field representation uses an indexed header field, from
the static table.
"""
e = Encoder()
header_set = {':authority': ''}
result = b'\x81'

assert e.encode(header_set, huffman=False) == result
assert list(e.header_table.dynamic_entries) == []

def test_indexed_header_field_from_static_table(self):
e = Encoder()
e.header_table_size = 0
Expand Down
Loading