1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-05-20 01:08:10 +00:00

refactor: simplify connector feature combos

This commit is contained in:
Rob Ede 2023-08-29 01:14:54 +01:00
parent 84eb8b306c
commit ac95362340
No known key found for this signature in database
GPG key ID: 97C636207D3EF933
2 changed files with 2 additions and 25 deletions

View file

@ -58,7 +58,7 @@ jobs:
run: |
cargo test --lib --tests -p=actix-router --all-features
cargo test --lib --tests -p=actix-http --all-features
cargo test --lib --tests -p=actix-web --features=rustls,openssl -- --skip=test_reading_deflate_encoding_large_random_rustls
cargo test --lib --tests -p=actix-web --features=rustls-0_20,rustls-0_21,openssl -- --skip=test_reading_deflate_encoding_large_random_rustls
cargo test --lib --tests -p=actix-web-codegen --all-features
cargo test --lib --tests -p=awc --all-features
cargo test --lib --tests -p=actix-http-test --all-features

View file

@ -109,33 +109,10 @@ impl Connector<()> {
OurTlsConnector::Rustls021(std::sync::Arc::new(config))
}
/// Build TLS connector with Rustls v0.21, based on supplied ALPN protocols
///
/// Note that if other TLS crate features are enabled, Rustls v0.21 will be used.
#[cfg(all(
all(feature = "rustls-0_20", feature = "openssl"),
not(feature = "rustls-0_21"),
))]
fn build_tls(protocols: Vec<Vec<u8>>) -> OurTlsConnector {
use actix_tls::connect::rustls_0_20::{reexports::ClientConfig, webpki_roots_cert_store};
let mut config = ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(webpki_roots_cert_store())
.with_no_client_auth();
config.alpn_protocols = protocols;
OurTlsConnector::Rustls020(std::sync::Arc::new(config))
}
/// Build TLS connector with Rustls v0.20, based on supplied ALPN protocols
///
/// Note that if other TLS crate features are enabled, Rustls v0.21 will be used.
#[cfg(all(
feature = "rustls-0_20",
not(any(feature = "rustls-0_21", feature = "openssl")),
))]
#[cfg(all(feature = "rustls-0_20", not(feature = "rustls-0_21")))]
fn build_tls(protocols: Vec<Vec<u8>>) -> OurTlsConnector {
use actix_tls::connect::rustls_0_20::{reexports::ClientConfig, webpki_roots_cert_store};