From f0e8375299292c453b2b52dfea0fdb01d2d84673 Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Fri, 6 Oct 2023 22:03:33 +0200 Subject: [PATCH] fix compilation issue --- gremlin-client/Cargo.toml | 4 ++-- gremlin-client/src/aio/connection.rs | 27 ++++++++++++++++----------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/gremlin-client/Cargo.toml b/gremlin-client/Cargo.toml index c1cabf14..9f4fd463 100644 --- a/gremlin-client/Cargo.toml +++ b/gremlin-client/Cargo.toml @@ -44,10 +44,10 @@ lazy_static = "1.3.0" base64 = "0.21.4" native-tls = "0.2.3" tungstenite = { version = "0.18.0", features = ["native-tls"] } -async-tungstenite = { version = "0.18", optional = true, default-features=false} +async-tungstenite = { version = "0.23", optional = true, default-features=false} async-std = { version = "1.4.0", optional = true, features = ["unstable","attributes"] } async-trait = { version = "0.1.10", optional = true } -async-tls = { version = "0.11", optional = true } +async-tls = { version = "0.12", optional = true } tokio-native-tls = { version = "0.3.0", optional = true } tokio-stream = { version = "0.1.2", optional = true } gremlin-derive = { path="../gremlin-derive", version="0.1", optional=true } diff --git a/gremlin-client/src/aio/connection.rs b/gremlin-client/src/aio/connection.rs index f76e72d5..a18d395e 100644 --- a/gremlin-client/src/aio/connection.rs +++ b/gremlin-client/src/aio/connection.rs @@ -74,18 +74,23 @@ impl std::fmt::Debug for Conn { #[cfg(feature = "async-std-runtime")] mod tls { + use std::time::SystemTime; + use crate::connection::ConnectionOptions; + use rustls::{Certificate, ServerName}; pub struct NoCertificateVerification {} - impl rustls::ServerCertVerifier for NoCertificateVerification { + impl rustls::client::ServerCertVerifier for NoCertificateVerification { fn verify_server_cert( &self, - _roots: &rustls::RootCertStore, - _presented_certs: &[rustls::Certificate], - _dns_name: webpki::DNSNameRef<'_>, - _ocsp: &[u8], - ) -> Result { - Ok(rustls::ServerCertVerified::assertion()) + _end_entity: &Certificate, + _intermediates: &[Certificate], + _server_name: &ServerName, + _scts: &mut dyn Iterator, + _ocsp_response: &[u8], + _now: SystemTime, + ) -> Result { + Ok(rustls::client::ServerCertVerified::assertion()) } } @@ -98,10 +103,10 @@ mod tls { .map(|tls| tls.accept_invalid_certs) .unwrap_or(false) { - let mut config = ClientConfig::new(); - config - .dangerous() - .set_certificate_verifier(Arc::new(NoCertificateVerification {})); + let config = ClientConfig::builder() + .with_safe_defaults() + .with_custom_certificate_verifier(Arc::new(NoCertificateVerification {})) + .with_no_client_auth(); Some(async_tls::TlsConnector::from(Arc::new(config))) } else {