fix: Upgrade to http2 if the server reports that it supports it (#1166)

The test is disabled as the test server does not support TLS currently
but otherwise I'd expect it to pass (tested in another project).
This commit is contained in:
Markus Westerlind
2021-02-10 22:16:22 +01:00
committed by GitHub
parent ad21b62fd2
commit 2940740493
2 changed files with 31 additions and 6 deletions

View File

@@ -370,17 +370,21 @@ impl Connector {
let mut http = hyper_rustls::HttpsConnector::from((http, tls.clone()));
let io = http.call(dst).await?;
if let hyper_rustls::MaybeHttpsStream::Https(stream) = &io {
if let hyper_rustls::MaybeHttpsStream::Https(stream) = io {
if !self.nodelay {
let (io, _) = stream.get_ref();
io.set_nodelay(false)?;
}
Ok(Conn {
inner: self.verbose.wrap(RustlsTlsConn { inner: stream }),
is_proxy,
})
} else {
Ok(Conn {
inner: self.verbose.wrap(io),
is_proxy,
})
}
Ok(Conn {
inner: self.verbose.wrap(io),
is_proxy,
})
}
}
}