prepare for native-tls 0.2

pull/28/head
Ryan Leckey 7 years ago
parent 1f037abc34
commit ef8e41f63f
  1. 3
      Cargo.toml
  2. 4
      src/client.rs

@ -34,3 +34,6 @@ version = "0.1.5"
[dev-dependencies]
env_logger = "0.5.3"
[patch.crates-io]
native-tls = { git = "https://github.com/sfackler/rust-native-tls.git" }

@ -25,11 +25,11 @@ mod encryption {
match mode {
Mode::Plain => Ok(StreamSwitcher::Plain(stream)),
Mode::Tls => {
let connector = TlsConnector::builder()?.build()?;
let connector = TlsConnector::builder().build()?;
connector.connect(domain, stream)
.map_err(|e| match e {
TlsHandshakeError::Failure(f) => f.into(),
TlsHandshakeError::Interrupted(_) => panic!("Bug: TLS handshake not blocked"),
TlsHandshakeError::WouldBlock(_) => panic!("Bug: TLS handshake not blocked"),
})
.map(StreamSwitcher::Tls)
}

Loading…
Cancel
Save