mirror of
https://github.com/denoland/deno
synced 2024-08-25 11:07:24 +00:00
fix(ext/http): smarter handling of Accept-Encoding (#22130)
This commit is contained in:
parent
98c537726e
commit
c66f7b6d8d
|
@ -2649,6 +2649,13 @@ const compressionTestCases = [
|
|||
out: { "Content-Type": "text/plain", "Cache-Control": "no-transform" },
|
||||
expect: null,
|
||||
},
|
||||
{
|
||||
name: "BadHeader",
|
||||
length: 1024,
|
||||
in: { "Accept-Encoding": "\x81" },
|
||||
out: { "Content-Type": "text/plain", "Cache-Control": "no-transform" },
|
||||
expect: null,
|
||||
},
|
||||
];
|
||||
|
||||
for (const testCase of compressionTestCases) {
|
||||
|
|
|
@ -558,11 +558,11 @@ fn is_request_compressible(
|
|||
return Compression::None;
|
||||
};
|
||||
|
||||
match accept_encoding.to_str().unwrap() {
|
||||
match accept_encoding.to_str() {
|
||||
// Firefox and Chrome send this -- no need to parse
|
||||
"gzip, deflate, br" => return Compression::Brotli,
|
||||
"gzip" => return Compression::GZip,
|
||||
"br" => return Compression::Brotli,
|
||||
Ok("gzip, deflate, br") => return Compression::Brotli,
|
||||
Ok("gzip") => return Compression::GZip,
|
||||
Ok("br") => return Compression::Brotli,
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue