Repository: seanmonstar/reqwest (language: rust)

Issue:
hyper-util panic when `http2` is disabled
## Cargo.toml

```toml
[package]
name = "reqwest-test"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1", features = ["macros", "rt"] }
# same with `native-tls-alpn`
reqwest = { version = "=0.12.0", default-features = false, features = ["rustls-tls-native-roots"] }
```

## src/main.rs

```rs
#[tokio::main(flavor = "current_thread")]
async fn main() {
    let text = reqwest::get("https://www.cloudflare.com/cdn-cgi/trace")
        .await
        .unwrap()
        .text()
        .await
        .unwrap();
    println!("{text}");
}
```

## Output

```
thread 'main' panicked at /home/<redacted>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-util-0.1.3/src/client/legacy/client.rs:554:33:
http2 feature is not enabled
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```


Discussion / hints:
I'm looking into what's causing it. I haven't seen how hyper v1 works yet and I'm curious to learn.

Fix patch:
diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs
index 926e21e59..a64869582 100644
--- a/src/async_impl/client.rs
+++ b/src/async_impl/client.rs
@@ -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(),
+                            ];
                         }
                     }
 


Test patch: