reqwest
reqwest copied to clipboard
Not sending ALPN when using socks5 proxy
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: https://github.com/seanmonstar/reqwest/blob/ddf7f24dcadb9a310b52300c531fe516a05e0c43/src/connect.rs#L148-L150 https://github.com/seanmonstar/reqwest/blob/ddf7f24dcadb9a310b52300c531fe516a05e0c43/src/connect.rs#L205-L225
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 encountered the same issue. Looking at the code, it looks like a bug.
This "feature" was introduced by #466. It seems that before it, it tried to use ALPN, but not properly activating h2 backend for some reason.
Since hyper v1 upgrade is on the way, #2131 will be closed and I open a new PR to branch hyper-v1. If needed, add the following in Cargo.toml for temp patch before hyper v1 upgrade finishes and you upgrade reqwest to latest version:
[patch.crates-io]
reqwest = { git = 'https://github.com/cxw620/lib_reqwest.git', rev = 'ed9dbc7649f53cd18b5bdfe88173064c95bd6b78' }