Skip to content

Commit

Permalink
Fix HeaderAcceptField comp
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtropets committed Jan 15, 2025
1 parent a2c0ea1 commit a774abd
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions include/ccf/http_accept.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,21 @@ namespace ccf::http

bool operator<(const AcceptHeaderField& other) const
{
if (q_factor != other.q_factor)
static constexpr auto float_comp_epsilon = 0.0000001f;
if (abs(q_factor - other.q_factor) > float_comp_epsilon)
{
return q_factor < other.q_factor;
}

if (is_wildcard(mime_type))
if (is_wildcard(mime_type) && !is_wildcard(other.mime_type))
{
return true;
}
else if (is_wildcard(other.mime_type))
{
return false;
}

if (is_wildcard(mime_subtype))
if (is_wildcard(mime_subtype) && !is_wildcard(other.mime_subtype))
{
return true;
}
else if (is_wildcard(other.mime_subtype))
{
return false;
}

// Spec says these mime types are now equivalent. For stability, we
// order them lexicographically
Expand Down

0 comments on commit a774abd

Please sign in to comment.