-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 quality parse error in Accept-Encoding HTTP header #2344
Conversation
e186396
to
9ce7eea
Compare
1901d5c
to
fc64d3d
Compare
0b402d1
to
d15ad3a
Compare
2d32177
to
0edd419
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice change, thanks for the contribution
I was able to sort out the problems you outlined in the description. Indeed adding the |
While #2322 is a valid bug report, I would tend to say that some of the additional changes made with this PR are a regression over the previous version.
/// Default Q-factor (quality) value.
#[inline]
pub fn quality(self) -> f64 {
match self {
ContentEncoding::Br => 1.1,
ContentEncoding::Gzip => 1.0,
ContentEncoding::Deflate => 0.9,
ContentEncoding::Identity | ContentEncoding::Auto => 0.1,
ContentEncoding::Zstd => 0.0,
}
} @robjtede could we try to recover the old server-side preference behavior? Or add an option to pass the preferred order to |
PR Type
Bug Fix
PR Checklist
Overview
HTTP header
Accept-Encoding
was not correctly parsed.Other changes:
ContentEncoding::parse
fail instead of returning default value.Issue open to discussion
I have change
CompressMiddleware
trait requirements.Indeed, I have not been able to use the
Either
trait correctly to answer available compress algorithm when we have to answer NotAcceptable status code.So the only way I have been able to work with is adding
From<String>
requirement toB
.This make
test common_combinations
fail (see: dade818). So I have disable it ...If anyone has a good idea to fix this, I will be happy to edit my PR.
Closes #2322