diff --git a/Cargo.toml b/Cargo.toml index c76b9ecf..2114d1e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,8 +66,8 @@ serde_json = "1.0.0" # Examples tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "net"] } env_logger = { version = "0.10", default-features = false } -tokio-rustls = "0.24" -webpki-roots = "0.25" +tokio-rustls = "0.26" +webpki-roots = "0.26" [package.metadata.docs.rs] features = ["stream"] diff --git a/examples/akamai.rs b/examples/akamai.rs index 8d87b778..385bcef7 100644 --- a/examples/akamai.rs +++ b/examples/akamai.rs @@ -3,7 +3,7 @@ use http::{Method, Request}; use tokio::net::TcpStream; use tokio_rustls::TlsConnector; -use tokio_rustls::rustls::{OwnedTrustAnchor, RootCertStore, ServerName}; +use tokio_rustls::rustls::{pki_types::ServerName, RootCertStore}; use std::error::Error; use std::net::ToSocketAddrs; @@ -15,17 +15,8 @@ pub async fn main() -> Result<(), Box> { let _ = env_logger::try_init(); let tls_client_config = std::sync::Arc::new({ - let mut root_store = RootCertStore::empty(); - root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| { - OwnedTrustAnchor::from_subject_spki_name_constraints( - ta.subject, - ta.spki, - ta.name_constraints, - ) - })); - + let root_store = RootCertStore::from_iter(webpki_roots::TLS_SERVER_ROOTS.iter().cloned()); let mut c = tokio_rustls::rustls::ClientConfig::builder() - .with_safe_defaults() .with_root_certificates(root_store) .with_no_client_auth(); c.alpn_protocols.push(ALPN_H2.as_bytes().to_owned());