From 3745b028c65158d8a4917c39110ba69671cbbde3 Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Fri, 25 Nov 2022 11:56:35 -0800 Subject: [PATCH] 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. --- src/response.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/response.rs b/src/response.rs index 7335417..cb655fe 100644 --- a/src/response.rs +++ b/src/response.rs @@ -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)), } } }