Skip to content

Commit

Permalink
fix compilation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Oct 6, 2023
1 parent f01522a commit f0e8375
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions gremlin-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
27 changes: 16 additions & 11 deletions gremlin-client/src/aio/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<rustls::ServerCertVerified, rustls::TLSError> {
Ok(rustls::ServerCertVerified::assertion())
_end_entity: &Certificate,
_intermediates: &[Certificate],
_server_name: &ServerName,
_scts: &mut dyn Iterator<Item = &[u8]>,
_ocsp_response: &[u8],
_now: SystemTime,
) -> Result<rustls::client::ServerCertVerified, rustls::TLSError> {

Check warning on line 92 in gremlin-client/src/aio/connection.rs

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-latest, stable, 3.6.5)

use of deprecated type alias `rustls::TLSError`: Use Error

Check warning on line 92 in gremlin-client/src/aio/connection.rs

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-latest, stable, 3.5.7)

use of deprecated type alias `rustls::TLSError`: Use Error

Check warning on line 92 in gremlin-client/src/aio/connection.rs

View workflow job for this annotation

GitHub Actions / grcov (ubuntu-latest, nightly, 3.6.2)

use of deprecated type alias `rustls::TLSError`: Use Error
Ok(rustls::client::ServerCertVerified::assertion())
}
}

Expand All @@ -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 {
Expand Down

0 comments on commit f0e8375

Please sign in to comment.