Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HeaderAcceptField comp #6762

Merged
merged 3 commits into from
Jan 17, 2025
Merged
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
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
Loading