
http-client pulled in rustls which in turn meant that gpui depended on rustls/aws-lc-sys. This commit extracts http-client-tls crate to separate the http-client and tls dependencies. Closes #ISSUE Release Notes: - N/A
21 lines
640 B
Rust
21 lines
640 B
Rust
use std::sync::OnceLock;
|
|
|
|
use rustls::ClientConfig;
|
|
use rustls_platform_verifier::ConfigVerifierExt;
|
|
|
|
static TLS_CONFIG: OnceLock<rustls::ClientConfig> = OnceLock::new();
|
|
|
|
pub fn tls_config() -> ClientConfig {
|
|
TLS_CONFIG
|
|
.get_or_init(|| {
|
|
// rustls uses the `aws_lc_rs` provider by default
|
|
// This only errors if the default provider has already
|
|
// been installed. We can ignore this `Result`.
|
|
rustls::crypto::aws_lc_rs::default_provider()
|
|
.install_default()
|
|
.ok();
|
|
|
|
ClientConfig::with_platform_verifier()
|
|
})
|
|
.clone()
|
|
}
|