Bump rustls to 0.20.1; add src to rustls error (#438)

This commit is contained in:
Malloc Voidstar
2021-12-17 00:32:00 -08:00
committed by GitHub
parent 876d5757a7
commit 1c1dfaa691
2 changed files with 2 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ cookie = { version = "0.15", default-features = false, optional = true}
once_cell = "1"
url = "2"
socks = { version = "0.3", optional = true }
rustls = { version = "0.20", optional = true }
rustls = { version = "0.20.1", optional = true }
webpki = { version = "0.22", optional = true }
webpki-roots = { version = "0.22", optional = true }
rustls-native-certs = { version = "0.6", optional = true }

View File

@@ -368,10 +368,9 @@ pub(crate) fn connect_https(unit: &Unit, hostname: &str) -> Result<Stream, Error
let mut sock = connect_host(unit, hostname, port)?;
let mut sess = rustls::ClientConnection::new(
tls_conf,
rustls::ServerName::try_from(hostname).map_err(|_e| ErrorKind::Dns.new())?,
rustls::ServerName::try_from(hostname).map_err(|e| ErrorKind::Dns.new().src(e))?,
)
.map_err(|e| ErrorKind::Io.new().src(e))?;
// TODO rustls 0.20.1: Add src to ServerName error (0.20 didn't implement StdError trait for it)
sess.complete_io(&mut sock)
.map_err(|err| ErrorKind::ConnectionFailed.new().src(err))?;