Skip to content
Merged
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 docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release notes
.. toctree::
:maxdepth: 2

releases/v6.5.4
releases/v6.5.3
releases/v6.5.2
releases/v6.5.1
Expand Down
13 changes: 13 additions & 0 deletions docs/releases/v6.5.4.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
What's new in Tornado 6.5.4
===========================

Dec 15, 2025
------------

Bug fixes
~~~~~~~~~

- The ``in`` operator for ``HTTPHeaders`` was incorrectly case-sensitive, causing
lookups to fail for headers with different casing than the original header name.
This was a regression in version 6.5.3 and has been fixed to restore the intended
case-insensitive behavior from version 6.5.2 and earlier.
4 changes: 2 additions & 2 deletions tornado/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# is zero for an official release, positive for a development branch,
# or negative for a release candidate or beta (after the base version
# number has been incremented)
version = "6.5.3"
version_info = (6, 5, 3, 0)
version = "6.5.4"
version_info = (6, 5, 4, 0)

import importlib
import typing
Expand Down
3 changes: 2 additions & 1 deletion tornado/httputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ def __contains__(self, name: object) -> bool:
# in __getitem__ when it's not needed.
if not isinstance(name, str):
return False
return name in self._as_list
norm_name = _normalize_header(name)
return norm_name in self._as_list

def __getitem__(self, name: str) -> str:
header = _normalize_header(name)
Expand Down
3 changes: 3 additions & 0 deletions tornado/test/httputil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ def test_multi_line(self):
sorted(list(headers.get_all())),
[("Asdf", "qwer zxcv"), ("Foo", "bar baz"), ("Foo", "even more lines")],
)
# Verify case insensitivity in-operator
self.assertTrue("asdf" in headers)
self.assertTrue("Asdf" in headers)

def test_continuation(self):
data = "Foo: bar\r\n\tasdf"
Expand Down