From 9eaea6a2fd2c9005e7e64887569dcc27fec98596 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 7 Feb 2021 03:54:58 +0000 Subject: [PATCH] tweak feature flags --- Cargo.toml | 12 ++++++------ README.md | 9 ++++----- actix-http-test/Cargo.toml | 6 +++--- actix-http-test/src/lib.rs | 5 ++++- actix-http/Cargo.toml | 10 +++++----- actix-http/tests/test_openssl.rs | 5 ++++- actix-http/tests/test_rustls.rs | 5 ++++- actix-web-actors/Cargo.toml | 2 +- awc/Cargo.toml | 10 +++++----- awc/tests/test_connector.rs | 7 +++++-- awc/tests/test_rustls_client.rs | 2 +- awc/tests/test_ssl_client.rs | 7 +++++-- src/lib.rs | 5 +++++ src/test.rs | 10 +++++----- tests/test_httpserver.rs | 11 ++++++++--- tests/test_server.rs | 11 ++++++++--- 16 files changed, 73 insertions(+), 44 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1e2c35d6a..479a89f87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,10 +47,10 @@ compress = ["actix-http/compress", "awc/compress"] secure-cookies = ["actix-http/secure-cookies"] # openssl -openssl = ["actix-tls/accept", "actix-tls/openssl", "awc/openssl", "open-ssl"] +openssl = ["tls_openssl", "actix-tls/accept", "actix-tls/openssl", "awc/openssl"] # rustls -rustls = ["actix-tls/accept", "actix-tls/rustls", "awc/rustls", "rust-tls"] +rustls = ["tls_rustls", "actix-tls/accept", "actix-tls/rustls", "awc/rustls"] [[example]] name = "basic" @@ -86,7 +86,7 @@ actix-web-codegen = "0.4.0" actix-http = "3.0.0-beta.1" awc = { version = "3.0.0-beta.1", default-features = false } -ahash = "0.6" +ahash = "0.7" bytes = "1" derive_more = "0.99.5" either = "1.5.3" @@ -101,10 +101,10 @@ regex = "1.4" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_urlencoded = "0.7" -time = { version = "0.2.7", default-features = false, features = ["std"] } +time = { version = "0.2.23", default-features = false, features = ["std"] } url = "2.1" -open-ssl = { package = "openssl", version = "0.10", optional = true } -rust-tls = { package = "rustls", version = "0.19.0", optional = true } +tls_openssl = { package = "openssl", version = "0.10.9", optional = true } +tls_rustls = { package = "rustls", version = "0.19.0", optional = true } smallvec = "1.6" [dev-dependencies] diff --git a/README.md b/README.md index 956bb3741..8a703117f 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,9 @@ ![License](https://img.shields.io/crates/l/actix-web.svg) [![Dependency Status](https://deps.rs/crate/actix-web/3.3.2/status.svg)](https://deps.rs/crate/actix-web/3.3.2)
-[![Build Status](https://travis-ci.org/actix/actix-web.svg?branch=master)](https://travis-ci.org/actix/actix-web) +[![build status](https://github.com/actix/actix-web/workflows/CI%20%28Linux%29/badge.svg?branch=master&event=push)](https://github.com/actix/actix-web/actions) [![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web) -[![Download](https://img.shields.io/crates/d/actix-web.svg)](https://crates.io/crates/actix-web) -[![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +![downloads](https://img.shields.io/crates/d/actix-web.svg) [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)

@@ -99,9 +98,9 @@ One of the fastest web frameworks available according to the This project is licensed under either of * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)) + [http://www.apache.org/licenses/LICENSE-2.0]) * MIT license ([LICENSE-MIT](LICENSE-MIT) or - [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)) + [http://opensource.org/licenses/MIT]) at your option. diff --git a/actix-http-test/Cargo.toml b/actix-http-test/Cargo.toml index 0a804e109..25fd74a10 100644 --- a/actix-http-test/Cargo.toml +++ b/actix-http-test/Cargo.toml @@ -26,7 +26,7 @@ path = "src/lib.rs" default = [] # openssl -openssl = ["open-ssl", "awc/openssl"] +openssl = ["tls-openssl", "awc/openssl"] [dependencies] actix-service = "2.0.0-beta.4" @@ -47,8 +47,8 @@ serde = "1.0" serde_json = "1.0" slab = "0.4" serde_urlencoded = "0.7" -time = { version = "0.2.7", default-features = false, features = ["std"] } -open-ssl = { version = "0.10", package = "openssl", optional = true } +time = { version = "0.2.23", default-features = false, features = ["std"] } +tls-openssl = { version = "0.10.9", package = "openssl", optional = true } [dev-dependencies] actix-web = "4.0.0-beta.1" diff --git a/actix-http-test/src/lib.rs b/actix-http-test/src/lib.rs index 2958b7f59..fcf8b3476 100644 --- a/actix-http-test/src/lib.rs +++ b/actix-http-test/src/lib.rs @@ -4,6 +4,9 @@ #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#[cfg(feature = "openssl")] +extern crate tls_openssl as openssl; + use std::sync::mpsc; use std::{net, thread, time}; @@ -82,7 +85,7 @@ pub async fn test_server_with_addr>( let connector = { #[cfg(feature = "openssl")] { - use open_ssl::ssl::{SslConnector, SslMethod, SslVerifyMode}; + use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode}; let mut builder = SslConnector::builder(SslMethod::tls()).unwrap(); builder.set_verify(SslVerifyMode::NONE); diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index f55dc3b69..22a54f569 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -58,7 +58,7 @@ encoding_rs = "0.8" futures-channel = { version = "0.3.7", default-features = false, features = ["alloc"] } futures-core = { version = "0.3.7", default-features = false, features = ["alloc"] } futures-util = { version = "0.3.7", default-features = false, features = ["alloc", "sink"] } -ahash = "0.6" +ahash = "0.7" h2 = "0.3.0" http = "0.2.2" httparse = "1.3" @@ -78,7 +78,7 @@ sha-1 = "0.9" smallvec = "1.6" slab = "0.4" serde_urlencoded = "0.7" -time = { version = "0.2.7", default-features = false, features = ["std"] } +time = { version = "0.2.23", default-features = false, features = ["std"] } # compression brotli2 = { version="0.3.2", optional = true } @@ -89,10 +89,10 @@ actix-server = "2.0.0-beta.3" actix-http-test = { version = "3.0.0-beta.1", features = ["openssl"] } actix-tls = { version = "3.0.0-beta.2", features = ["openssl"] } criterion = "0.3" -env_logger = "0.7" +env_logger = "0.8" serde_derive = "1.0" -open-ssl = { version="0.10", package = "openssl" } -rust-tls = { version="0.19", package = "rustls" } +tls-openssl = { version = "0.10", package = "openssl" } +tls-rustls = { version = "0.19", package = "rustls" } [[bench]] name = "write-camel-case" diff --git a/actix-http/tests/test_openssl.rs b/actix-http/tests/test_openssl.rs index f20cfd70c..73bbe6208 100644 --- a/actix-http/tests/test_openssl.rs +++ b/actix-http/tests/test_openssl.rs @@ -1,4 +1,7 @@ #![cfg(feature = "openssl")] + +extern crate tls_openssl as openssl; + use std::io; use actix_http::error::{ErrorBadRequest, PayloadError}; @@ -11,7 +14,7 @@ use actix_service::{fn_service, ServiceFactoryExt}; use bytes::{Bytes, BytesMut}; use futures_util::future::{err, ok, ready}; use futures_util::stream::{once, Stream, StreamExt}; -use open_ssl::ssl::{AlpnError, SslAcceptor, SslFiletype, SslMethod}; +use openssl::ssl::{AlpnError, SslAcceptor, SslFiletype, SslMethod}; async fn load_body(stream: S) -> Result where diff --git a/actix-http/tests/test_rustls.rs b/actix-http/tests/test_rustls.rs index 2f6b31f49..59ffcfeb0 100644 --- a/actix-http/tests/test_rustls.rs +++ b/actix-http/tests/test_rustls.rs @@ -1,4 +1,7 @@ #![cfg(feature = "rustls")] + +extern crate tls_rustls as rustls; + use actix_http::error::PayloadError; use actix_http::http::header::{self, HeaderName, HeaderValue}; use actix_http::http::{Method, StatusCode, Version}; @@ -9,7 +12,7 @@ use actix_service::{fn_factory_with_config, fn_service}; use bytes::{Bytes, BytesMut}; use futures_util::future::{self, err, ok}; use futures_util::stream::{once, Stream, StreamExt}; -use rust_tls::{ +use rustls::{ internal::pemfile::{certs, pkcs8_private_keys}, NoClientAuth, ServerConfig as RustlsServerConfig, }; diff --git a/actix-web-actors/Cargo.toml b/actix-web-actors/Cargo.toml index c6fd1c233..522279fd0 100644 --- a/actix-web-actors/Cargo.toml +++ b/actix-web-actors/Cargo.toml @@ -29,5 +29,5 @@ tokio = { version = "1", features = ["sync"] } [dev-dependencies] actix-rt = "2" -env_logger = "0.7" +env_logger = "0.8" futures-util = { version = "0.3.7", default-features = false } diff --git a/awc/Cargo.toml b/awc/Cargo.toml index 24275b6f5..7a9130780 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -28,10 +28,10 @@ features = ["openssl", "rustls", "compress"] default = ["compress"] # openssl -openssl = ["open-ssl", "actix-http/openssl"] +openssl = ["tls-openssl", "actix-http/openssl"] # rustls -rustls = ["rust-tls", "actix-http/rustls"] +rustls = ["tls-rustls", "actix-http/rustls"] # content-encoding support compress = ["actix-http/compress"] @@ -54,8 +54,8 @@ rand = "0.8" serde = "1.0" serde_json = "1.0" serde_urlencoded = "0.7" -open-ssl = { version = "0.10", package = "openssl", optional = true } -rust-tls = { version = "0.19.0", package = "rustls", optional = true, features = ["dangerous_configuration"] } +tls-openssl = { version = "0.10.9", package = "openssl", optional = true } +tls-rustls = { version = "0.19.0", package = "rustls", optional = true, features = ["dangerous_configuration"] } [dev-dependencies] actix-web = { version = "4.0.0-beta.1", features = ["openssl"] } @@ -68,6 +68,6 @@ actix-tls = { version = "3.0.0-beta.3", features = ["openssl", "rustls"] } brotli2 = "0.3.2" flate2 = "1.0.13" futures-util = { version = "0.3.7", default-features = false } -env_logger = "0.7" +env_logger = "0.8" rcgen = "0.8" webpki = "0.21" diff --git a/awc/tests/test_connector.rs b/awc/tests/test_connector.rs index e500801c4..4e4fa5833 100644 --- a/awc/tests/test_connector.rs +++ b/awc/tests/test_connector.rs @@ -1,10 +1,13 @@ #![cfg(feature = "openssl")] + +extern crate tls_openssl as openssl; + use actix_http::HttpService; use actix_http_test::test_server; use actix_service::{map_config, ServiceFactoryExt}; use actix_web::http::Version; use actix_web::{dev::AppConfig, web, App, HttpResponse}; -use open_ssl::ssl::{SslAcceptor, SslConnector, SslFiletype, SslMethod, SslVerifyMode}; +use openssl::ssl::{SslAcceptor, SslConnector, SslFiletype, SslMethod, SslVerifyMode}; fn ssl_acceptor() -> SslAcceptor { // load ssl keys @@ -20,7 +23,7 @@ fn ssl_acceptor() -> SslAcceptor { if protos.windows(3).any(|window| window == H2) { Ok(b"h2") } else { - Err(open_ssl::ssl::AlpnError::NOACK) + Err(openssl::ssl::AlpnError::NOACK) } }); builder.set_alpn_protos(b"\x02h2").unwrap(); diff --git a/awc/tests/test_rustls_client.rs b/awc/tests/test_rustls_client.rs index 2da3d9696..b0f3b71be 100644 --- a/awc/tests/test_rustls_client.rs +++ b/awc/tests/test_rustls_client.rs @@ -1,6 +1,6 @@ #![cfg(feature = "rustls")] -extern crate rust_tls as rustls; +extern crate tls_rustls as rustls; use std::{ io::BufReader, diff --git a/awc/tests/test_ssl_client.rs b/awc/tests/test_ssl_client.rs index de1514042..064824d59 100644 --- a/awc/tests/test_ssl_client.rs +++ b/awc/tests/test_ssl_client.rs @@ -1,4 +1,7 @@ #![cfg(feature = "openssl")] + +extern crate tls_openssl as openssl; + use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; @@ -8,7 +11,7 @@ use actix_service::{map_config, pipeline_factory, ServiceFactoryExt}; use actix_web::http::Version; use actix_web::{dev::AppConfig, web, App, HttpResponse}; use futures_util::future::ok; -use open_ssl::ssl::{SslAcceptor, SslConnector, SslFiletype, SslMethod, SslVerifyMode}; +use openssl::ssl::{SslAcceptor, SslConnector, SslFiletype, SslMethod, SslVerifyMode}; fn ssl_acceptor() -> SslAcceptor { // load ssl keys @@ -24,7 +27,7 @@ fn ssl_acceptor() -> SslAcceptor { if protos.windows(3).any(|window| window == H2) { Ok(b"h2") } else { - Err(open_ssl::ssl::AlpnError::NOACK) + Err(openssl::ssl::AlpnError::NOACK) } }); builder.set_alpn_protos(b"\x02h2").unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 52471f4b3..46fbc2937 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,6 +71,11 @@ #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#[cfg(feature = "openssl")] +extern crate tls_openssl as openssl; +#[cfg(feature = "rustls")] +extern crate tls_rustls as rustls; + mod app; mod app_service; mod config; diff --git a/src/test.rs b/src/test.rs index 3acb520ff..62c329c91 100644 --- a/src/test.rs +++ b/src/test.rs @@ -773,7 +773,7 @@ where let connector = { #[cfg(feature = "openssl")] { - use open_ssl::ssl::{SslConnector, SslMethod, SslVerifyMode}; + use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode}; let mut builder = SslConnector::builder(SslMethod::tls()).unwrap(); builder.set_verify(SslVerifyMode::NONE); @@ -825,9 +825,9 @@ enum HttpVer { enum StreamType { Tcp, #[cfg(feature = "openssl")] - Openssl(open_ssl::ssl::SslAcceptor), + Openssl(openssl::ssl::SslAcceptor), #[cfg(feature = "rustls")] - Rustls(rust_tls::ServerConfig), + Rustls(rustls::ServerConfig), } impl Default for TestServerConfig { @@ -865,14 +865,14 @@ impl TestServerConfig { /// Start openssl server #[cfg(feature = "openssl")] - pub fn openssl(mut self, acceptor: open_ssl::ssl::SslAcceptor) -> Self { + pub fn openssl(mut self, acceptor: openssl::ssl::SslAcceptor) -> Self { self.stream = StreamType::Openssl(acceptor); self } /// Start rustls server #[cfg(feature = "rustls")] - pub fn rustls(mut self, config: rust_tls::ServerConfig) -> Self { + pub fn rustls(mut self, config: rustls::ServerConfig) -> Self { self.stream = StreamType::Rustls(config); self } diff --git a/tests/test_httpserver.rs b/tests/test_httpserver.rs index 78d4ef685..cd5a75d49 100644 --- a/tests/test_httpserver.rs +++ b/tests/test_httpserver.rs @@ -2,7 +2,12 @@ use std::sync::mpsc; use std::{thread, time::Duration}; #[cfg(feature = "openssl")] -use open_ssl::ssl::SslAcceptorBuilder; +extern crate tls_openssl as openssl; +#[cfg(feature = "rustls")] +extern crate tls_rustls as rustls; + +#[cfg(feature = "openssl")] +use openssl::ssl::SslAcceptorBuilder; use actix_web::{test, web, App, HttpResponse, HttpServer}; @@ -70,7 +75,7 @@ async fn test_start() { #[allow(clippy::unnecessary_wraps)] #[cfg(feature = "openssl")] fn ssl_acceptor() -> std::io::Result { - use open_ssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; + use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; // load ssl keys let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap(); builder @@ -116,7 +121,7 @@ async fn test_start_ssl() { }); let (srv, sys) = rx.recv().unwrap(); - use open_ssl::ssl::{SslConnector, SslMethod, SslVerifyMode}; + use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode}; let mut builder = SslConnector::builder(SslMethod::tls()).unwrap(); builder.set_verify(SslVerifyMode::NONE); let _ = builder diff --git a/tests/test_server.rs b/tests/test_server.rs index 0f51a2fdb..c626474cf 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -1,3 +1,8 @@ +#[cfg(feature = "openssl")] +extern crate tls_openssl as openssl; +#[cfg(feature = "rustls")] +extern crate tls_rustls as rustls; + use std::{ future::Future, io::{Read, Write}, @@ -713,7 +718,7 @@ async fn test_brotli_encoding_large() { #[actix_rt::test] async fn test_brotli_encoding_large_openssl() { // load ssl keys - use open_ssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; + use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap(); builder .set_private_key_file("tests/key.pem", SslFiletype::PEM) @@ -753,8 +758,8 @@ async fn test_brotli_encoding_large_openssl() { #[cfg(all(feature = "rustls", feature = "openssl"))] #[actix_rt::test] async fn test_reading_deflate_encoding_large_random_rustls() { - use rust_tls::internal::pemfile::{certs, pkcs8_private_keys}; - use rust_tls::{NoClientAuth, ServerConfig}; + use rustls::internal::pemfile::{certs, pkcs8_private_keys}; + use rustls::{NoClientAuth, ServerConfig}; use std::fs::File; use std::io::BufReader;