1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-02 01:05:08 +02:00

Replace brotli with brotli2 #1224

This commit is contained in:
Nikolay Kim
2019-12-20 13:50:07 +06:00
parent 8c54054844
commit 1d12ba9d5f
12 changed files with 108 additions and 139 deletions

View File

@ -4,7 +4,7 @@ use std::pin::Pin;
use std::task::{Context, Poll};
use actix_threadpool::{run, CpuFuture};
use brotli::DecompressorWriter;
use brotli2::write::BrotliDecoder;
use bytes::Bytes;
use flate2::write::{GzDecoder, ZlibDecoder};
use futures_core::{ready, Stream};
@ -31,7 +31,7 @@ where
pub fn new(stream: S, encoding: ContentEncoding) -> Decoder<S> {
let decoder = match encoding {
ContentEncoding::Br => Some(ContentDecoder::Br(Box::new(
DecompressorWriter::new(Writer::new(), 0),
BrotliDecoder::new(Writer::new()),
))),
ContentEncoding::Deflate => Some(ContentDecoder::Deflate(Box::new(
ZlibDecoder::new(Writer::new()),
@ -137,7 +137,7 @@ where
enum ContentDecoder {
Deflate(Box<ZlibDecoder<Writer>>),
Gzip(Box<GzDecoder<Writer>>),
Br(Box<DecompressorWriter<Writer>>),
Br(Box<BrotliDecoder<Writer>>),
}
impl ContentDecoder {