Skip to content

Commit 871af25

Browse files
paolobarboliniNutomic
authored andcommitted
fix: could panic if http2 disabled but TLS negotiated h2 (seanmonstar#2194)
The fix is only ask for h2 ALPN iff the http2 feature is enabled. Closes seanmonstar#2192
1 parent 97886ac commit 871af25

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
@@ -592,7 +592,11 @@ impl ClientBuilder {
592592
tls.alpn_protocols = vec!["h3".into()];
593593
}
594594
HttpVersionPref::All => {
595-
tls.alpn_protocols = vec!["h2".into(), "http/1.1".into()];
595+
tls.alpn_protocols = vec![
596+
#[cfg(feature = "http2")]
597+
"h2".into(),
598+
"http/1.1".into(),
599+
];
596600
}
597601
}
598602

0 commit comments

Comments
 (0)