From 4b98a7b07a67061f4be0de762bdf27810eaefd17 Mon Sep 17 00:00:00 2001 From: quininer Date: Sun, 13 Aug 2017 13:05:47 +0800 Subject: [PATCH] [Changed] update rustls --- Cargo.toml | 4 ++-- src/lib.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9c31b71..4372692 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tokio-rustls" -version = "0.2.4" +version = "0.3.0" authors = ["quininer kel "] license = "MIT/Apache-2.0" repository = "https://github.com/quininer/tokio-rustls" @@ -16,7 +16,7 @@ danger = [ "rustls/dangerous_configuration" ] [dependencies] futures = "0.1" tokio-io = "0.1" -rustls = "0.9" +rustls = "0.10" tokio-proto = { version = "0.1", optional = true } [dev-dependencies] diff --git a/src/lib.rs b/src/lib.rs index 1c1aa11..5c24c18 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,21 +59,21 @@ impl ClientConfigExt for Arc { -> ConnectAsync where S: AsyncRead + AsyncWrite { - use rustls::{ ServerCertVerifier, RootCertStore, Certificate, TLSError }; + use rustls::{ ServerCertVerifier, RootCertStore, Certificate, ServerCertVerified, TLSError }; struct NoCertVerifier; impl ServerCertVerifier for NoCertVerifier { - fn verify_server_cert(&self, _: &RootCertStore, _: &[Certificate], _: &str) - -> Result<(), TLSError> + fn verify_server_cert(&self, _: &RootCertStore, _: &[Certificate], _: &str, _: &[u8]) + -> Result { - Ok(()) + Ok(ServerCertVerified::assertion()) } } let mut client_config = ClientConfig::new(); client_config.clone_from(self); client_config.dangerous() - .set_certificate_verifier(Box::new(NoCertVerifier)); + .set_certificate_verifier(Arc::new(NoCertVerifier)); Arc::new(client_config).connect_async("", stream) }