summaryrefslogtreecommitdiff
path: root/ext/tls/lib.rs
diff options
context:
space:
mode:
authorAndreu Botella <abb@randomunok.com>2021-10-25 09:41:06 -0700
committerGitHub <noreply@github.com>2021-10-25 18:41:06 +0200
commite39dace8cb4b1868e811fd13b87f2a81e84b98ce (patch)
tree3ed900bdd0e340ae74c9278846d407092bfa1901 /ext/tls/lib.rs
parent2e888cc82433aa143c0edadbd8c134b8fe030f50 (diff)
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.
Diffstat (limited to 'ext/tls/lib.rs')
-rw-r--r--ext/tls/lib.rs2
1 files changed, 2 insertions, 0 deletions
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()