From fa07415721fa09738b4e33cfd6fd94e75f60bf3a Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 12 Dec 2019 15:08:08 +0600 Subject: [PATCH] Replace flate2-xxx features with compress --- Cargo.toml | 19 ++++++++----------- actix-framed/tests/test_server.rs | 14 +++++++------- actix-http/CHANGES.md | 4 ++++ actix-http/Cargo.toml | 13 +++++-------- actix-http/src/encoding/decoder.rs | 13 ------------- actix-http/src/encoding/encoder.rs | 11 ----------- actix-http/src/h1/encoder.rs | 1 + actix-http/src/lib.rs | 3 ++- awc/Cargo.toml | 23 +++++++++-------------- awc/tests/test_ws.rs | 21 ++++++--------------- src/lib.rs | 6 +----- test-server/Cargo.toml | 10 +++++----- tests/test_server.rs | 20 +------------------- 13 files changed, 49 insertions(+), 109 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9e2b7815..f75e4a31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"] edition = "2018" [package.metadata.docs.rs] -features = ["openssl", "flate2-zlib", "secure-cookies", "client"] +features = ["openssl", "compress", "secure-cookies", "client"] [badges] travis-ci = { repository = "actix/actix-web", branch = "master" } @@ -43,16 +43,13 @@ members = [ ] [features] -default = ["flate2-zlib", "client", "fail"] +default = ["compress", "client", "fail"] # http client client = ["awc"] -# miniz-sys backend for flate2 crate -flate2-zlib = ["actix-http/flate2-zlib", "awc/flate2-zlib"] - -# rust backend for flate2 crate -flate2-rust = ["actix-http/flate2-rust", "awc/flate2-rust"] +# content-encoding support +compress = ["actix-http/compress", "awc/compress"] # sessions feature, session require "ring" crate and c compiler secure-cookies = ["actix-http/secure-cookies"] @@ -68,7 +65,7 @@ rustls = ["actix-tls/rustls", "awc/rustls"] [dependencies] actix-codec = "0.2.0" actix-service = "1.0.0" -actix-utils = "1.0.1" +actix-utils = "1.0.3" actix-router = "0.2.0" actix-rt = "1.0.0" actix-server = "1.0.0" @@ -77,8 +74,8 @@ actix-threadpool = "0.3.0" actix-tls = "1.0.0" actix-web-codegen = "0.2.0-alpha.2" -actix-http = "1.0.0-alpha.4" -awc = { version = "1.0.0-alpha.4", default-features = false, optional = true } +actix-http = "1.0.0" +awc = { version = "1.0.0", default-features = false, optional = true } bytes = "0.5.2" derive_more = "0.99.2" @@ -104,7 +101,7 @@ rand = "0.7" env_logger = "0.6" serde_derive = "1.0" brotli = "3.3.0" -flate2 = "1.0.2" +flate2 = "1.0.13" open-ssl = { version="0.10", package = "openssl" } rust_tls = { version = "0.16.0", package = "rustls" } diff --git a/actix-framed/tests/test_server.rs b/actix-framed/tests/test_server.rs index 0e265d89..f6b06863 100644 --- a/actix-framed/tests/test_server.rs +++ b/actix-framed/tests/test_server.rs @@ -3,7 +3,7 @@ use actix_http::{body, http::StatusCode, ws, Error, HttpService, Response}; use actix_http_test::TestServer; use actix_service::{pipeline_factory, IntoServiceFactory, ServiceFactory}; use actix_utils::framed::Dispatcher; -use bytes::BytesMut; +use bytes::Bytes; use futures::{future, SinkExt, StreamExt}; use actix_framed::{FramedApp, FramedRequest, FramedRoute, SendError, VerifyWebSockets}; @@ -29,9 +29,9 @@ async fn service(msg: ws::Frame) -> Result { let msg = match msg { ws::Frame::Ping(msg) => ws::Message::Pong(msg), ws::Frame::Text(text) => { - ws::Message::Text(String::from_utf8_lossy(&text.unwrap()).to_string()) + ws::Message::Text(String::from_utf8_lossy(&text).to_string()) } - ws::Frame::Binary(bin) => ws::Message::Binary(bin.unwrap().freeze()), + ws::Frame::Binary(bin) => ws::Message::Binary(bin), ws::Frame::Close(reason) => ws::Message::Close(reason), _ => panic!(), }; @@ -60,7 +60,7 @@ async fn test_simple() { let (item, mut framed) = framed.into_future().await; assert_eq!( item.unwrap().unwrap(), - ws::Frame::Text(Some(BytesMut::from("text"))) + ws::Frame::Text(Bytes::from_static(b"text")) ); framed @@ -70,7 +70,7 @@ async fn test_simple() { let (item, mut framed) = framed.into_future().await; assert_eq!( item.unwrap().unwrap(), - ws::Frame::Binary(Some(BytesMut::from(&b"text"[..]))) + ws::Frame::Binary(Bytes::from_static(b"text")) ); framed.send(ws::Message::Ping("text".into())).await.unwrap(); @@ -126,7 +126,7 @@ async fn test_service() { let (item, mut framed) = framed.into_future().await; assert_eq!( item.unwrap().unwrap(), - ws::Frame::Text(Some(BytesMut::from("text"))) + ws::Frame::Text(Bytes::from_static(b"text")) ); framed @@ -136,7 +136,7 @@ async fn test_service() { let (item, mut framed) = framed.into_future().await; assert_eq!( item.unwrap().unwrap(), - ws::Frame::Binary(Some(BytesMut::from(&b"text"[..]))) + ws::Frame::Binary(Bytes::from_static(b"text")) ); framed.send(ws::Message::Ping("text".into())).await.unwrap(); diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 052b3eff..587abaf7 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -6,6 +6,10 @@ * Add websockets continuation frame support +### Changed + +* Replace `flate2-xxx` features with `compress` + ## [1.0.0-alpha.5] - 2019-12-09 ### Fixed diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 79e8777d..14c3c44d 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -15,7 +15,7 @@ license = "MIT/Apache-2.0" edition = "2018" [package.metadata.docs.rs] -features = ["openssl", "rustls", "fail", "flate2-zlib", "secure-cookies"] +features = ["openssl", "rustls", "fail", "compress", "secure-cookies"] [lib] name = "actix_http" @@ -30,11 +30,8 @@ openssl = ["actix-tls/openssl", "actix-connect/openssl"] # rustls support rustls = ["actix-tls/rustls", "actix-connect/rustls"] -# miniz-sys backend for flate2 crate -flate2-zlib = ["flate2/miniz-sys"] - -# rust backend for flate2 crate -flate2-rust = ["flate2/rust_backend"] +# enable compressison support +compress = ["flate2", "brotli"] # failure integration. actix does not use failure anymore fail = ["failure"] @@ -84,8 +81,8 @@ time = "0.1.42" ring = { version = "0.16.9", optional = true } # compression -brotli = "3.3.0" -flate2 = { version="1.0.7", optional = true, default-features = false } +brotli = { version = "3.3.0", optional = true } +flate2 = { version = "1.0.13", optional = true } # optional deps failure = { version = "0.1.5", optional = true } diff --git a/actix-http/src/encoding/decoder.rs b/actix-http/src/encoding/decoder.rs index 35be2d13..10635b3b 100644 --- a/actix-http/src/encoding/decoder.rs +++ b/actix-http/src/encoding/decoder.rs @@ -6,7 +6,6 @@ use std::task::{Context, Poll}; use actix_threadpool::{run, CpuFuture}; use brotli::DecompressorWriter; use bytes::Bytes; -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] use flate2::write::{GzDecoder, ZlibDecoder}; use futures::{ready, Stream}; @@ -34,11 +33,9 @@ where ContentEncoding::Br => Some(ContentDecoder::Br(Box::new( DecompressorWriter::new(Writer::new(), 0), ))), - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoding::Deflate => Some(ContentDecoder::Deflate(Box::new( ZlibDecoder::new(Writer::new()), ))), - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoding::Gzip => Some(ContentDecoder::Gzip(Box::new( GzDecoder::new(Writer::new()), ))), @@ -138,15 +135,12 @@ where } enum ContentDecoder { - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] Deflate(Box>), - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] Gzip(Box>), Br(Box>), } impl ContentDecoder { - #[allow(unreachable_patterns)] fn feed_eof(&mut self) -> io::Result> { match self { ContentDecoder::Br(ref mut decoder) => match decoder.flush() { @@ -160,7 +154,6 @@ impl ContentDecoder { } Err(e) => Err(e), }, - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentDecoder::Gzip(ref mut decoder) => match decoder.try_finish() { Ok(_) => { let b = decoder.get_mut().take(); @@ -172,7 +165,6 @@ impl ContentDecoder { } Err(e) => Err(e), }, - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentDecoder::Deflate(ref mut decoder) => match decoder.try_finish() { Ok(_) => { let b = decoder.get_mut().take(); @@ -184,11 +176,9 @@ impl ContentDecoder { } Err(e) => Err(e), }, - _ => Ok(None), } } - #[allow(unreachable_patterns)] fn feed_data(&mut self, data: Bytes) -> io::Result> { match self { ContentDecoder::Br(ref mut decoder) => match decoder.write_all(&data) { @@ -203,7 +193,6 @@ impl ContentDecoder { } Err(e) => Err(e), }, - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentDecoder::Gzip(ref mut decoder) => match decoder.write_all(&data) { Ok(_) => { decoder.flush()?; @@ -216,7 +205,6 @@ impl ContentDecoder { } Err(e) => Err(e), }, - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentDecoder::Deflate(ref mut decoder) => match decoder.write_all(&data) { Ok(_) => { decoder.flush()?; @@ -229,7 +217,6 @@ impl ContentDecoder { } Err(e) => Err(e), }, - _ => Ok(Some(data)), } } } diff --git a/actix-http/src/encoding/encoder.rs b/actix-http/src/encoding/encoder.rs index f8f996ff..c58e1f43 100644 --- a/actix-http/src/encoding/encoder.rs +++ b/actix-http/src/encoding/encoder.rs @@ -7,7 +7,6 @@ use std::task::{Context, Poll}; use actix_threadpool::{run, CpuFuture}; use brotli::CompressorWriter; use bytes::Bytes; -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] use flate2::write::{GzEncoder, ZlibEncoder}; use crate::body::{Body, BodySize, MessageBody, ResponseBody}; @@ -172,9 +171,7 @@ fn update_head(encoding: ContentEncoding, head: &mut ResponseHead) { } enum ContentEncoder { - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] Deflate(ZlibEncoder), - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] Gzip(GzEncoder), Br(Box>), } @@ -182,12 +179,10 @@ enum ContentEncoder { impl ContentEncoder { fn encoder(encoding: ContentEncoding) -> Option { match encoding { - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoding::Deflate => Some(ContentEncoder::Deflate(ZlibEncoder::new( Writer::new(), flate2::Compression::fast(), ))), - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoding::Gzip => Some(ContentEncoder::Gzip(GzEncoder::new( Writer::new(), flate2::Compression::fast(), @@ -208,9 +203,7 @@ impl ContentEncoder { std::mem::swap(encoder, &mut encoder_new); encoder_new.into_inner().freeze() } - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoder::Deflate(ref mut encoder) => encoder.get_mut().take(), - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoder::Gzip(ref mut encoder) => encoder.get_mut().take(), } } @@ -218,12 +211,10 @@ impl ContentEncoder { fn finish(self) -> Result { match self { ContentEncoder::Br(encoder) => Ok(encoder.into_inner().buf.freeze()), - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoder::Gzip(encoder) => match encoder.finish() { Ok(writer) => Ok(writer.buf.freeze()), Err(err) => Err(err), }, - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoder::Deflate(encoder) => match encoder.finish() { Ok(writer) => Ok(writer.buf.freeze()), Err(err) => Err(err), @@ -240,7 +231,6 @@ impl ContentEncoder { Err(err) } }, - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoder::Gzip(ref mut encoder) => match encoder.write_all(data) { Ok(_) => Ok(()), Err(err) => { @@ -248,7 +238,6 @@ impl ContentEncoder { Err(err) } }, - #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] ContentEncoder::Deflate(ref mut encoder) => match encoder.write_all(data) { Ok(_) => Ok(()), Err(err) => { diff --git a/actix-http/src/h1/encoder.rs b/actix-http/src/h1/encoder.rs index e83ce90c..e474d4f8 100644 --- a/actix-http/src/h1/encoder.rs +++ b/actix-http/src/h1/encoder.rs @@ -108,6 +108,7 @@ pub(crate) trait MessageType: Sized { } else { dst.put_slice(b"\r\ncontent-length: "); } + #[allow(clippy::write_with_newline)] write!(dst.writer(), "{}\r\n", len)?; } BodySize::None => dst.put_slice(b"\r\n"), diff --git a/actix-http/src/lib.rs b/actix-http/src/lib.rs index 1da074ad..b682e5aa 100644 --- a/actix-http/src/lib.rs +++ b/actix-http/src/lib.rs @@ -5,7 +5,7 @@ clippy::too_many_arguments, clippy::new_without_default, clippy::borrow_interior_mutable_const, - clippy::write_with_newline +// clippy::write_with_newline )] #[macro_use] @@ -16,6 +16,7 @@ mod builder; pub mod client; mod cloneable; mod config; +#[cfg(feature = "compress")] pub mod encoding; mod extensions; mod header; diff --git a/awc/Cargo.toml b/awc/Cargo.toml index 49cdb782..a183b9fe 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "awc" -version = "1.0.0-alpha.4" +version = "1.0.0" authors = ["Nikolay Kim "] description = "Actix http client." readme = "README.md" @@ -12,19 +12,17 @@ categories = ["network-programming", "asynchronous", "web-programming::http-client", "web-programming::websocket"] license = "MIT/Apache-2.0" -exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"] edition = "2018" -workspace = ".." [lib] name = "awc" path = "src/lib.rs" [package.metadata.docs.rs] -features = ["openssl", "rustls", "flate2-zlib"] +features = ["openssl", "rustls", "compress"] [features] -default = ["flate2-zlib"] +default = ["compress"] # openssl openssl = ["open-ssl", "actix-http/openssl"] @@ -32,16 +30,13 @@ openssl = ["open-ssl", "actix-http/openssl"] # rustls rustls = ["rust-tls", "actix-http/rustls"] -# miniz-sys backend for flate2 crate -flate2-zlib = ["actix-http/flate2-zlib"] - -# rust backend for flate2 crate -flate2-rust = ["actix-http/flate2-rust"] +# content-encoding support +compress = ["actix-http/compress"] [dependencies] actix-codec = "0.2.0" actix-service = "1.0.0" -actix-http = "1.0.0-alpha.4" +actix-http = "1.0.0" actix-rt = "1.0.0" base64 = "0.11" @@ -61,12 +56,12 @@ rust-tls = { version = "0.16.0", package="rustls", optional = true, features = [ [dev-dependencies] actix-connect = { version = "1.0.0", features=["openssl"] } actix-web = { version = "2.0.0-alpha.3", features=["openssl"] } -actix-http = { version = "1.0.0-alpha.4", features=["openssl"] } +actix-http = { version = "1.0.0", features=["openssl"] } actix-http-test = { version = "1.0.0-alpha.3", features=["openssl"] } actix-utils = "1.0.0" actix-server = "1.0.0" actix-tls = { version = "1.0.0", features=["openssl", "rustls"] } brotli = "3.3.0" -flate2 = { version="1.0.2" } +flate2 = "1.0.13" env_logger = "0.6" -webpki = { version = "0.21" } +webpki = "0.21" diff --git a/awc/tests/test_ws.rs b/awc/tests/test_ws.rs index 52dbb129..6f1dcded 100644 --- a/awc/tests/test_ws.rs +++ b/awc/tests/test_ws.rs @@ -3,26 +3,17 @@ use std::io; use actix_codec::Framed; use actix_http::{body::BodySize, h1, ws, Error, HttpService, Request, Response}; use actix_http_test::TestServer; -use bytes::{Bytes, BytesMut}; +use bytes::Bytes; use futures::future::ok; use futures::{SinkExt, StreamExt}; async fn ws_service(req: ws::Frame) -> Result { match req { ws::Frame::Ping(msg) => Ok(ws::Message::Pong(msg)), - ws::Frame::Text(text) => { - let text = if let Some(pl) = text { - String::from_utf8(Vec::from(pl.as_ref())).unwrap() - } else { - String::new() - }; - Ok(ws::Message::Text(text)) - } - ws::Frame::Binary(bin) => Ok(ws::Message::Binary( - bin.map(|e| e.freeze()) - .unwrap_or_else(|| Bytes::from("")) - .into(), + ws::Frame::Text(text) => Ok(ws::Message::Text( + String::from_utf8(Vec::from(text.as_ref())).unwrap(), )), + ws::Frame::Binary(bin) => Ok(ws::Message::Binary(bin)), ws::Frame::Close(reason) => Ok(ws::Message::Close(reason)), _ => Ok(ws::Message::Close(None)), } @@ -56,14 +47,14 @@ async fn test_simple() { .await .unwrap(); let item = framed.next().await.unwrap().unwrap(); - assert_eq!(item, ws::Frame::Text(Some(BytesMut::from("text")))); + assert_eq!(item, ws::Frame::Text(Bytes::from_static(b"text"))); framed .send(ws::Message::Binary("text".into())) .await .unwrap(); let item = framed.next().await.unwrap().unwrap(); - assert_eq!(item, ws::Frame::Binary(Some(BytesMut::from(&b"text"[..])))); + assert_eq!(item, ws::Frame::Binary(Bytes::from_static(b"text"))); framed.send(ws::Message::Ping("text".into())).await.unwrap(); let item = framed.next().await.unwrap().unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 524c6378..8d46cd80 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,15 +71,11 @@ //! ## Package feature //! //! * `client` - enables http client (default enabled) +//! * `compress` - enables content encoding compression support (default enabled) //! * `openssl` - enables ssl support via `openssl` crate, supports `http/2` //! * `rustls` - enables ssl support via `rustls` crate, supports `http/2` //! * `secure-cookies` - enables secure cookies support, includes `ring` crate as //! dependency -//! * `flate2-zlib` - enables `gzip`, `deflate` compression support, requires -//! `c` compiler (default enabled) -//! * `flate2-rust` - experimental rust based implementation for -//! `gzip`, `deflate` compression. -//! #![allow(clippy::type_complexity, clippy::new_without_default)] mod app; diff --git a/test-server/Cargo.toml b/test-server/Cargo.toml index 27440401..434262de 100644 --- a/test-server/Cargo.toml +++ b/test-server/Cargo.toml @@ -27,17 +27,17 @@ path = "src/lib.rs" default = [] # openssl -openssl = ["open-ssl", "awc/openssl", ] # "actix-tls/openssl"] +openssl = ["open-ssl", "awc/openssl"] [dependencies] actix-service = "1.0.0" actix-codec = "0.2.0" actix-connect = "1.0.0" -actix-utils = "1.0.0" +actix-utils = "1.0.3" actix-rt = "1.0.0" actix-server = "1.0.0" actix-testing = "1.0.0" -awc = "1.0.0-alpha.3" +awc = "1.0.0" base64 = "0.11" bytes = "0.5.2" @@ -55,5 +55,5 @@ time = "0.1" open-ssl = { version="0.10", package="openssl", optional = true } [dev-dependencies] -actix-web = "2.0.0-alpha.3" -actix-http = "1.0.0-alpha.3" +actix-web = "2.0.0-alpha.4" +actix-http = "1.0.0" diff --git a/tests/test_server.rs b/tests/test_server.rs index 505b6cc0..4f9e2c7e 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -56,7 +56,6 @@ async fn test_body() { assert_eq!(bytes, Bytes::from_static(STR.as_ref())); } -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] #[actix_rt::test] async fn test_body_gzip() { let srv = TestServer::start(|| { @@ -86,7 +85,6 @@ async fn test_body_gzip() { assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref())); } -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] #[actix_rt::test] async fn test_body_gzip2() { let srv = TestServer::start(|| { @@ -118,7 +116,6 @@ async fn test_body_gzip2() { assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref())); } -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] #[actix_rt::test] async fn test_body_encoding_override() { let srv = TestServer::start(|| { @@ -179,7 +176,6 @@ async fn test_body_encoding_override() { assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref())); } -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] #[actix_rt::test] async fn test_body_gzip_large() { let data = STR.repeat(10); @@ -216,7 +212,6 @@ async fn test_body_gzip_large() { assert_eq!(Bytes::from(dec), Bytes::from(data)); } -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] #[actix_rt::test] async fn test_body_gzip_large_random() { let data = rand::thread_rng() @@ -257,7 +252,6 @@ async fn test_body_gzip_large_random() { assert_eq!(Bytes::from(dec), Bytes::from(data)); } -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] #[actix_rt::test] async fn test_body_chunked_implicit() { let srv = TestServer::start(move || { @@ -378,7 +372,6 @@ async fn test_no_chunking() { } #[actix_rt::test] -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] async fn test_body_deflate() { let srv = TestServer::start(move || { HttpService::build() @@ -440,7 +433,6 @@ async fn test_body_brotli() { } #[actix_rt::test] -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] async fn test_encoding() { let srv = TestServer::start(move || { HttpService::build() @@ -469,7 +461,6 @@ async fn test_encoding() { } #[actix_rt::test] -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] async fn test_gzip_encoding() { let srv = TestServer::start(move || { HttpService::build() @@ -498,7 +489,6 @@ async fn test_gzip_encoding() { } #[actix_rt::test] -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] async fn test_gzip_encoding_large() { let data = STR.repeat(10); let srv = TestServer::start(move || { @@ -528,7 +518,6 @@ async fn test_gzip_encoding_large() { } #[actix_rt::test] -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] async fn test_reading_gzip_encoding_large_random() { let data = rand::thread_rng() .sample_iter(&Alphanumeric) @@ -563,7 +552,6 @@ async fn test_reading_gzip_encoding_large_random() { } #[actix_rt::test] -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] async fn test_reading_deflate_encoding() { let srv = TestServer::start(move || { HttpService::build() @@ -592,7 +580,6 @@ async fn test_reading_deflate_encoding() { } #[actix_rt::test] -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] async fn test_reading_deflate_encoding_large() { let data = STR.repeat(10); let srv = TestServer::start(move || { @@ -622,7 +609,6 @@ async fn test_reading_deflate_encoding_large() { } #[actix_rt::test] -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] async fn test_reading_deflate_encoding_large_random() { let data = rand::thread_rng() .sample_iter(&Alphanumeric) @@ -771,11 +757,7 @@ async fn test_brotli_encoding_large() { // assert_eq!(bytes, Bytes::from(data)); // } -#[cfg(all( - feature = "rustls", - feature = "openssl", - any(feature = "flate2-zlib", feature = "flate2-rust") -))] +#[cfg(all(feature = "rustls", feature = "openssl"))] #[actix_rt::test] async fn test_reading_deflate_encoding_large_random_ssl() { use open_ssl::ssl::{SslConnector, SslMethod, SslVerifyMode};