mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-23 16:21:06 +01:00
tweak feature flags
This commit is contained in:
parent
830fb2cdb2
commit
9eaea6a2fd
12
Cargo.toml
12
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]
|
||||
|
@ -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)
|
||||
<br />
|
||||
[![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)
|
||||
|
||||
</p>
|
||||
@ -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.
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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<F: ServiceFactory<TcpStream>>(
|
||||
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);
|
||||
|
@ -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"
|
||||
|
@ -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<S>(stream: S) -> Result<BytesMut, PayloadError>
|
||||
where
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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 }
|
||||
|
@ -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"
|
||||
|
@ -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();
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![cfg(feature = "rustls")]
|
||||
|
||||
extern crate rust_tls as rustls;
|
||||
extern crate tls_rustls as rustls;
|
||||
|
||||
use std::{
|
||||
io::BufReader,
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
10
src/test.rs
10
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
|
||||
}
|
||||
|
@ -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<SslAcceptorBuilder> {
|
||||
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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user