Skip to content

Commit

Permalink
fix: could panic if http2 disabled but TLS negotiated h2 (#2194)
Browse files Browse the repository at this point in the history
The fix is only ask for h2 ALPN iff the http2 feature is enabled.

Closes #2192
  • Loading branch information
paolobarbolini committed Mar 20, 2024
1 parent d5051f9 commit 7a5df21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,11 @@ impl ClientBuilder {
tls.alpn_protocols = vec!["h3".into()];
}
HttpVersionPref::All => {
tls.alpn_protocols = vec!["h2".into(), "http/1.1".into()];
tls.alpn_protocols = vec![
#[cfg(feature = "http2")]
"h2".into(),
"http/1.1".into(),
];
}
}

Expand Down

0 comments on commit 7a5df21

Please sign in to comment.