Skip to content

Commit

Permalink
Revert "Fix deflate decompression (#1927)"
Browse files Browse the repository at this point in the history
This reverts commit 8396233.
  • Loading branch information
seanmonstar committed Aug 23, 2023
1 parent 8b49fc9 commit a24dbed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ gzip = ["async-compression", "async-compression/gzip", "tokio-util"]

brotli = ["async-compression", "async-compression/brotli", "tokio-util"]

deflate = ["async-compression", "async-compression/deflate", "tokio-util"]
deflate = ["async-compression", "async-compression/zlib", "tokio-util"]

json = ["serde_json"]

Expand Down
6 changes: 3 additions & 3 deletions src/async_impl/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use async_compression::tokio::bufread::GzipDecoder;
use async_compression::tokio::bufread::BrotliDecoder;

#[cfg(feature = "deflate")]
use async_compression::tokio::bufread::DeflateDecoder;
use async_compression::tokio::bufread::ZlibDecoder;

use bytes::Bytes;
use futures_core::Stream;
Expand Down Expand Up @@ -62,7 +62,7 @@ enum Inner {

/// A `Deflate` decoder will uncompress the deflated response content before returning it.
#[cfg(feature = "deflate")]
Deflate(Pin<Box<FramedRead<DeflateDecoder<PeekableIoStreamReader>, BytesCodec>>>),
Deflate(Pin<Box<FramedRead<ZlibDecoder<PeekableIoStreamReader>, BytesCodec>>>),

/// A decoder that doesn't have a value yet.
#[cfg(any(feature = "brotli", feature = "gzip", feature = "deflate"))]
Expand Down Expand Up @@ -324,7 +324,7 @@ impl Future for Pending {
))))),
#[cfg(feature = "deflate")]
DecoderType::Deflate => Poll::Ready(Ok(Inner::Deflate(Box::pin(FramedRead::new(
DeflateDecoder::new(StreamReader::new(_body)),
ZlibDecoder::new(StreamReader::new(_body)),
BytesCodec::new(),
))))),
}
Expand Down
2 changes: 1 addition & 1 deletion tests/deflate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async fn deflate_case(response_size: usize, chunk_size: usize) {
.into_iter()
.map(|i| format!("test {}", i))
.collect();
let mut encoder = libflate::deflate::Encoder::new(Vec::new());
let mut encoder = libflate::zlib::Encoder::new(Vec::new()).unwrap();
match encoder.write(content.as_bytes()) {
Ok(n) => assert!(n > 0, "Failed to write to encoder."),
_ => panic!("Failed to deflate encode string."),
Expand Down

0 comments on commit a24dbed

Please sign in to comment.