In http_request.h, get_header_value is currently implemented as:
if (headers.count(key))
{
return headers.find(key)->second;
}
When headers is a ci_map (std::unordered_multimap), this results in two independent
lookups. In particular, count() may traverse all elements with the given
key, followed by another lookup in find().
Unless there is a specific reason for this, the same behaviour can be
achieved with a single lookup:
auto it = headers.find(key);
if (it != headers.end())
{
return it->second;
}
In http_request.h, get_header_value is currently implemented as:
When headers is a ci_map (std::unordered_multimap), this results in two independent
lookups. In particular, count() may traverse all elements with the given
key, followed by another lookup in find().
Unless there is a specific reason for this, the same behaviour can be
achieved with a single lookup: