diff --git a/src/tls.rs b/src/tls.rs index 4c1179926..a085bdec2 100644 --- a/src/tls.rs +++ b/src/tls.rs @@ -3,13 +3,14 @@ use std::net::SocketAddr; use std::time::Duration; use hyper::net::{SslClient, HttpStream, NetworkStream}; -use native_tls::{ClientBuilder, TlsStream as NativeTlsStream, HandshakeError}; +use native_tls::{TlsConnector, TlsStream as NativeTlsStream, HandshakeError}; -pub struct TlsClient(ClientBuilder); +pub struct TlsClient(TlsConnector); impl TlsClient { pub fn new() -> ::Result { - ClientBuilder::new() + TlsConnector::builder() + .and_then(|c| c.build()) .map(TlsClient) .map_err(|e| ::Error::Http(::hyper::Error::Ssl(Box::new(e)))) } @@ -19,7 +20,7 @@ impl SslClient for TlsClient { type Stream = TlsStream; fn wrap_client(&self, stream: HttpStream, host: &str) -> ::hyper::Result { - self.0.handshake(host, stream).map(TlsStream).map_err(|e| { + self.0.connect(host, stream).map(TlsStream).map_err(|e| { match e { HandshakeError::Failure(e) => ::hyper::Error::Ssl(Box::new(e)), HandshakeError::Interrupted(..) => {