Skip to content

Commit

Permalink
fix: could panic if http2 disabled but TLS negotiated h2 (seanmonstar…
Browse files Browse the repository at this point in the history
…#2194)

The fix is only ask for h2 ALPN iff the http2 feature is enabled.

Closes seanmonstar#2192
  • Loading branch information
paolobarbolini authored and Nutomic committed Nov 7, 2024
1 parent 97886ac commit 871af25
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 @@ -592,7 +592,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 871af25

Please sign in to comment.