Skip to content

Commit

Permalink
fix the TLS verifier not(MacOS)
Browse files Browse the repository at this point in the history
  • Loading branch information
blind-oracle committed Nov 5, 2024
1 parent 8e1e695 commit f747239
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@ uuid = { version = "1.10.0", features = ["v7"] }
vrl = { version = "0.19.0", default-features = false, features = ["value"] }
x509-parser = "0.16.0"
zeroize = { version = "1.8.1", features = ["derive"] }

[target.'cfg(not(target_os = "macos"))'.dependencies]
webpki-roots = "0.26.6"
8 changes: 3 additions & 5 deletions src/tls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,13 @@ pub fn prepare_client_config(tls_versions: &[&'static SupportedProtocolVersion])
// new_with_extra_roots() method isn't available on MacOS, see
// https://github.com/rustls/rustls-platform-verifier/issues/58
#[cfg(not(target_os = "macos"))]
let verifier = Arc::new(Verifier::new_with_extra_roots(
webpki_roots::TLS_SERVER_ROOTS.to_vec(),
));
let verifier = Verifier::new_with_extra_roots(webpki_roots::TLS_SERVER_ROOTS.to_vec()).unwrap();
#[cfg(target_os = "macos")]
let verifier = Arc::new(Verifier::new());
let verifier = Verifier::new();

let mut cfg = ClientConfig::builder_with_protocol_versions(tls_versions)
.dangerous() // Nothing really dangerous here
.with_custom_certificate_verifier(verifier)
.with_custom_certificate_verifier(Arc::new(verifier))
.with_no_client_auth();

// Session resumption
Expand Down

0 comments on commit f747239

Please sign in to comment.