fix(http): prefer brotli for equal compression q-values#35011
Conversation
ReviewThe core fix is right: A few things before merge: 🔴 Regression: unknown encoding tokens now disable compressionThe old code filtered the iterator before selecting: .filter(|r| matches!(r, Ok((Some(Identity|Gzip|Brotli), _))))which silently dropped parse errors. The new helper instead propagates them via let (encoding, qval) = encoding?; // propagates Err(UnknownEncoding)
Suggested fix — ignore unparseable tokens instead of propagating: for encoding in encodings {
let Ok((encoding, qval)) = encoding else { continue; };
...
}If you do this, the function no longer needs to return 🟡 Same bug remains in the legacy
|
64a158d to
68a37eb
Compare
Co-Authored-By: Divy Srivastava <[email protected]>
68a37eb to
5dc473f
Compare
Summary:
Tests:
Closes #23050
Closes denoland/divybot#531