[Changed] update rustls
This commit is contained in:
parent
36fabdadfd
commit
4b98a7b07a
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tokio-rustls"
|
||||
version = "0.2.4"
|
||||
version = "0.3.0"
|
||||
authors = ["quininer kel <quininer@live.com>"]
|
||||
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]
|
||||
|
10
src/lib.rs
10
src/lib.rs
@ -59,21 +59,21 @@ impl ClientConfigExt for Arc<ClientConfig> {
|
||||
-> ConnectAsync<S>
|
||||
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<ServerCertVerified, TLSError>
|
||||
{
|
||||
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user