mirror of https://github.com/fafhrd91/actix-web
remove mutex features
This commit is contained in:
parent
52a28e8e68
commit
b2440ad66d
|
@ -8,7 +8,7 @@ ci-full = "check --workspace --all-features --bins --tests --examples"
|
|||
ci-test = "test --workspace --all-features --lib --tests --no-fail-fast -- --nocapture"
|
||||
ci-doctest = "test --workspace --all-features --doc --no-fail-fast -- --nocapture"
|
||||
|
||||
|
||||
ci-feature-powerset-check-no-tls="hack --workspace --feature-powerset --skip=__compress,rustls,openssl check"
|
||||
ci-feature-powerset-check-rustls="hack --workspace --feature-powerset --features=rustls --skip=__compress,openssl check"
|
||||
ci-feature-powerset-check-openssl="hack --workspace --feature-powerset --features=openssl --skip=__compress,rustls check"
|
||||
ci-feature-powerset-check-both="hack --workspace --feature-powerset --features=rustls,openssl --skip=__compress check"
|
||||
|
|
|
@ -115,10 +115,8 @@ jobs:
|
|||
|
||||
- name: check feature combinations
|
||||
# if: github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
cargo ci-feature-powerset-check-no-tls
|
||||
cargo ci-feature-powerset-check-openssl
|
||||
cargo ci-feature-powerset-check-rustls
|
||||
uses: actions-rs/cargo@v1
|
||||
with: { command: ci-feature-powerset-check-both }
|
||||
|
||||
coverage:
|
||||
name: coverage
|
||||
|
|
|
@ -68,15 +68,15 @@ __compress = []
|
|||
[dependencies]
|
||||
actix-codec = "0.4.0"
|
||||
actix-macros = "0.2.3"
|
||||
actix-router = "0.5.0-beta.2"
|
||||
actix-rt = "2.2"
|
||||
actix-server = "2.0.0-beta.3"
|
||||
actix-service = "2.0.0"
|
||||
actix-utils = "3.0.0"
|
||||
actix-tls = { version = "3.0.0-beta.7", default-features = false, optional = true }
|
||||
|
||||
actix-web-codegen = "0.5.0-beta.5"
|
||||
actix-http = "3.0.0-beta.11"
|
||||
actix-router = "0.5.0-beta.2"
|
||||
actix-web-codegen = "0.5.0-beta.5"
|
||||
|
||||
ahash = "0.7"
|
||||
bytes = "1"
|
||||
|
|
|
@ -79,14 +79,24 @@ impl Connector<()> {
|
|||
SslConnector::None
|
||||
}
|
||||
|
||||
/// Provides an empty TLS connector when no TLS feature is enabled.
|
||||
#[cfg(all(feature = "openssl", feature = "rustls"))]
|
||||
fn build_ssl(_: Vec<Vec<u8>>) -> SslConnector {
|
||||
compile_error!("openssl and rustls features are mutually exclusive");
|
||||
panic!("openssl and rustls features are mutually exclusive");
|
||||
/// Build TLS connector with rustls, based on supplied ALPN protocols
|
||||
///
|
||||
/// Note that if both `openssl` and `rustls` features are enabled, rustls will be used.
|
||||
#[cfg(feature = "rustls")]
|
||||
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector {
|
||||
use actix_tls::connect::tls::rustls::{webpki_roots_cert_store, ClientConfig};
|
||||
|
||||
let mut config = ClientConfig::builder()
|
||||
.with_safe_defaults()
|
||||
.with_root_certificates(webpki_roots_cert_store())
|
||||
.with_no_client_auth();
|
||||
|
||||
config.alpn_protocols = protocols;
|
||||
|
||||
SslConnector::Rustls(std::sync::Arc::new(config))
|
||||
}
|
||||
|
||||
// Build TLS connector with openssl, based on supplied alpn protocols
|
||||
/// Build TLS connector with openssl, based on supplied ALPN protocols
|
||||
#[cfg(all(feature = "openssl", not(feature = "rustls")))]
|
||||
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector {
|
||||
use actix_tls::connect::tls::openssl::{
|
||||
|
@ -107,21 +117,6 @@ impl Connector<()> {
|
|||
|
||||
SslConnector::Openssl(ssl.build())
|
||||
}
|
||||
|
||||
// Build TLS connector with rustls, based on supplied alpn protocols
|
||||
#[cfg(all(feature = "rustls", not(feature = "openssl")))]
|
||||
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector {
|
||||
use actix_tls::connect::tls::rustls::{webpki_roots_cert_store, ClientConfig};
|
||||
|
||||
let mut config = ClientConfig::builder()
|
||||
.with_safe_defaults()
|
||||
.with_root_certificates(webpki_roots_cert_store())
|
||||
.with_no_client_auth();
|
||||
|
||||
config.alpn_protocols = protocols;
|
||||
|
||||
SslConnector::Rustls(std::sync::Arc::new(config))
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> Connector<S> {
|
||||
|
|
Loading…
Reference in New Issue