I met with a weird issue. When using socks5 proxy, reqwest will use HTTP/1.1 during request, though HTTP/2 when using http/https proxy. Through Charles and verbose log I found that no ALPN were sent when using socks5 proxy.
I checked source code and noticed such codes:
|
let mut tls_proxy = tls.clone(); |
|
tls_proxy.alpn_protocols.clear(); |
|
(Arc::new(tls), Arc::new(tls_proxy)) |
|
#[cfg(feature = "__rustls")] |
|
Inner::RustlsTls { tls_proxy, .. } => { |
|
if dst.scheme() == Some(&Scheme::HTTPS) { |
|
use std::convert::TryFrom; |
|
use tokio_rustls::TlsConnector as RustlsConnector; |
|
|
|
let tls = tls_proxy.clone(); |
|
let host = dst.host().ok_or("no host in url")?.to_string(); |
|
let conn = socks::connect(proxy, dst, dns).await?; |
|
let server_name = rustls::ServerName::try_from(host.as_str()) |
|
.map_err(|_| "Invalid Server Name")?; |
|
let io = RustlsConnector::from(tls) |
|
.connect(server_name, conn) |
|
.await?; |
|
return Ok(Conn { |
|
inner: self.verbose.wrap(RustlsTlsConn { inner: io }), |
|
is_proxy: false, |
|
tls_info: false, |
|
}); |
|
} |
|
} |
I think here should clone tls instead of tls_proxy since tls_proxy.alpn_protocols.clear() introduced in #466 fixing #459.

I simply verified my thoughts with testing, but I'm still uncertain, so I submit this issue.
I met with a weird issue. When using socks5 proxy, reqwest will use HTTP/1.1 during request, though HTTP/2 when using http/https proxy. Through Charles and verbose log I found that no ALPN were sent when using socks5 proxy.
I checked source code and noticed such codes:
reqwest/src/connect.rs
Lines 148 to 150 in ddf7f24
reqwest/src/connect.rs
Lines 205 to 225 in ddf7f24
I think here should clone

tlsinstead oftls_proxysincetls_proxy.alpn_protocols.clear()introduced in #466 fixing #459.I simply verified my thoughts with testing, but I'm still uncertain, so I submit this issue.