Switch to MultiGzDecoder

This is more correct, since all gzip streams can consist of multiple members. It
has the happy side effect that it causes gzipped responses to reliably return
their streams to the pool.
This commit is contained in:
Jacob Hoffman-Andrews
2022-11-25 11:56:35 -08:00
parent 5d9e89917c
commit 3745b028c6

View File

@@ -22,7 +22,7 @@ use serde::de::DeserializeOwned;
use encoding_rs::Encoding;
#[cfg(feature = "gzip")]
use flate2::read::GzDecoder;
use flate2::read::MultiGzDecoder;
#[cfg(feature = "brotli")]
use brotli_decompressor::Decompressor as BrotliDecoder;
@@ -600,7 +600,7 @@ impl Compression {
#[cfg(feature = "brotli")]
Compression::Brotli => Box::new(BrotliDecoder::new(reader, 4096)),
#[cfg(feature = "gzip")]
Compression::Gzip => Box::new(GzDecoder::new(reader)),
Compression::Gzip => Box::new(MultiGzDecoder::new(reader)),
}
}
}