mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
fix: use proper ALPN protocols if HTTP client is HTTP/1.1 only (#19303)
Closes https://github.com/denoland/deno/issues/16923 --------- Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com>
This commit is contained in:
parent
fc6ba92024
commit
d90a75c036
6 changed files with 81 additions and 4 deletions
|
@ -745,7 +745,14 @@ pub fn create_http_client(
|
|||
options.client_cert_chain_and_key,
|
||||
)?;
|
||||
|
||||
tls_config.alpn_protocols = vec!["h2".into(), "http/1.1".into()];
|
||||
let mut alpn_protocols = vec![];
|
||||
if options.http2 {
|
||||
alpn_protocols.push("h2".into());
|
||||
}
|
||||
if options.http1 {
|
||||
alpn_protocols.push("http/1.1".into());
|
||||
}
|
||||
tls_config.alpn_protocols = alpn_protocols;
|
||||
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert(USER_AGENT, user_agent.parse().unwrap());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue