[Changed] update rustls
This commit is contained in:
parent
36fabdadfd
commit
4b98a7b07a
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tokio-rustls"
|
name = "tokio-rustls"
|
||||||
version = "0.2.4"
|
version = "0.3.0"
|
||||||
authors = ["quininer kel <quininer@live.com>"]
|
authors = ["quininer kel <quininer@live.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
repository = "https://github.com/quininer/tokio-rustls"
|
repository = "https://github.com/quininer/tokio-rustls"
|
||||||
@ -16,7 +16,7 @@ danger = [ "rustls/dangerous_configuration" ]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
tokio-io = "0.1"
|
tokio-io = "0.1"
|
||||||
rustls = "0.9"
|
rustls = "0.10"
|
||||||
tokio-proto = { version = "0.1", optional = true }
|
tokio-proto = { version = "0.1", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
10
src/lib.rs
10
src/lib.rs
@ -59,21 +59,21 @@ impl ClientConfigExt for Arc<ClientConfig> {
|
|||||||
-> ConnectAsync<S>
|
-> ConnectAsync<S>
|
||||||
where S: AsyncRead + AsyncWrite
|
where S: AsyncRead + AsyncWrite
|
||||||
{
|
{
|
||||||
use rustls::{ ServerCertVerifier, RootCertStore, Certificate, TLSError };
|
use rustls::{ ServerCertVerifier, RootCertStore, Certificate, ServerCertVerified, TLSError };
|
||||||
|
|
||||||
struct NoCertVerifier;
|
struct NoCertVerifier;
|
||||||
impl ServerCertVerifier for NoCertVerifier {
|
impl ServerCertVerifier for NoCertVerifier {
|
||||||
fn verify_server_cert(&self, _: &RootCertStore, _: &[Certificate], _: &str)
|
fn verify_server_cert(&self, _: &RootCertStore, _: &[Certificate], _: &str, _: &[u8])
|
||||||
-> Result<(), TLSError>
|
-> Result<ServerCertVerified, TLSError>
|
||||||
{
|
{
|
||||||
Ok(())
|
Ok(ServerCertVerified::assertion())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut client_config = ClientConfig::new();
|
let mut client_config = ClientConfig::new();
|
||||||
client_config.clone_from(self);
|
client_config.clone_from(self);
|
||||||
client_config.dangerous()
|
client_config.dangerous()
|
||||||
.set_certificate_verifier(Box::new(NoCertVerifier));
|
.set_certificate_verifier(Arc::new(NoCertVerifier));
|
||||||
|
|
||||||
Arc::new(client_config).connect_async("", stream)
|
Arc::new(client_config).connect_async("", stream)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user