From e39dace8cb4b1868e811fd13b87f2a81e84b98ce Mon Sep 17 00:00:00 2001 From: Andreu Botella Date: Mon, 25 Oct 2021 09:41:06 -0700 Subject: fix(tls): Make TLS clients support HTTP/2 (#12530) `fetch()` and client-side websocket used to support HTTP/2, but this regressed in #11491. This patch reenables it by explicitly adding `h2` and `http/1.1` to the list of ALPN protocols on the HTTP and websocket clients. --- ext/tls/lib.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ext/tls/lib.rs') diff --git a/ext/tls/lib.rs b/ext/tls/lib.rs index 076ef59fb..fb4fac85b 100644 --- a/ext/tls/lib.rs +++ b/ext/tls/lib.rs @@ -238,6 +238,8 @@ pub fn create_http_client( .expect("invalid client key or certificate"); } + tls_config.alpn_protocols = vec!["h2".into(), "http/1.1".into()]; + let mut headers = HeaderMap::new(); headers.insert(USER_AGENT, user_agent.parse().unwrap()); let mut builder = Client::builder() -- cgit v1.2.3