]> git.ipfire.org Git - thirdparty/squid.git/commit
Fix key equality comparison in LookupTable map (#1379)
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 14 Jun 2023 14:09:38 +0000 (14:09 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Fri, 30 Jun 2023 12:55:30 +0000 (00:55 +1200)
commit61444c8175528589baa341402c365253cebd09fd
treee0e6df86404fa84702d1396194aad90013c205b0
parentd990b25b80f6c70578440a6b39f912614032386e
Fix key equality comparison in LookupTable map (#1379)

An std::unordered_map with case-insensitive keys must use a
case-insensitive key equality comparison. lookupTable_t used (the
default) std::equal_to<SBuf> comparison which is case-sensitive.

The full extent of this bug effects is unknown, but Squid was
mishandling Cache-Control and Surrogate-Control directives with
non-canonical (i.e. other than all-lower-case) spelling. Similar
problems affected WWW-Authenticate Digest parameter names, but the
related code remains inconsistent, with both case-sensitive and
case-insensitive checks applied to some of the key names in
Auth::Digest::Config::decode().

Also removed a similarly buggy (and, technically, unused) "typical use"
example from the CaseInsensitiveSBufHash class description. C++
documentation and Squid code are better sources of usage examples when
it comes to STL-used concepts like hash function objects.

This minimal fix excludes LookupTable class polishing.

The bug was introduced in 2015 commit 81ab22b.
src/base/LookupTable.h
src/sbuf/Algorithms.h
src/tests/testLookupTable.cc