mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 15:21:26 -05:00
fix(ext/http): smarter handling of Accept-Encoding (#22130)
This commit is contained in:
parent
568ba673a8
commit
d2643fadb9
2 changed files with 11 additions and 4 deletions
|
@ -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…
Add table
Reference in a new issue