2x faster headers.get, headers.delete, headers.has (#18571)

This commit is contained in:
Jarred Sumner
2025-03-28 01:15:00 -07:00
committed by GitHub
parent 8e0c8a143e
commit accccbfdaf
4 changed files with 36 additions and 18 deletions

View File

@@ -219,6 +219,16 @@ bool HTTPHeaderMap::remove(const StringView name)
if (findHTTPHeaderName(name, headerName))
return remove(headerName);
return removeUncommonHeader(name);
}
bool HTTPHeaderMap::removeUncommonHeader(const StringView name)
{
#if ASSERT_ENABLED
HTTPHeaderName headerName;
ASSERT(!findHTTPHeaderName(name, headerName));
#endif
return m_uncommonHeaders.removeFirstMatching([&](auto& header) {
return equalIgnoringASCIICase(header.key, name);
});