Skip to content

Commit 7a5df21

Browse files
fix: could panic if http2 disabled but TLS negotiated h2 (#2194)
The fix is only ask for h2 ALPN iff the http2 feature is enabled. Closes #2192
1 parent d5051f9 commit 7a5df21

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/async_impl/client.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,11 @@ impl ClientBuilder {
590590
tls.alpn_protocols = vec!["h3".into()];
591591
}
592592
HttpVersionPref::All => {
593-
tls.alpn_protocols = vec!["h2".into(), "http/1.1".into()];
593+
tls.alpn_protocols = vec![
594+
#[cfg(feature = "http2")]
595+
"h2".into(),
596+
"http/1.1".into(),
597+
];
594598
}
595599
}
596600

0 commit comments

Comments
 (0)