lib/httpx/plugins/compression/deflate.rb in httpx-0.11.3 vs lib/httpx/plugins/compression/deflate.rb in httpx-0.12.0
- old
+ new
@@ -16,23 +16,20 @@
module Deflater
module_function
def deflate(raw, buffer, chunk_size:)
- deflater = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,
- Zlib::MAX_WBITS,
- Zlib::MAX_MEM_LEVEL,
- Zlib::HUFFMAN_ONLY)
+ deflater = Zlib::Deflate.new
while (chunk = raw.read(chunk_size))
compressed = deflater.deflate(chunk)
buffer << compressed
yield compressed if block_given?
end
last = deflater.finish
buffer << last
yield last if block_given?
ensure
- deflater.close
+ deflater.close if deflater
end
end
module_function