Repository: seanmonstar/reqwest (language: rust)

Issue:
reqwest 0.12.x  incompatible with 0.11.x
During the process of upgrading xh to reqwest 0.12, I found two places that are incompatible with 0.11.x. 

I wonder if this is a problem or a feature?

1. works ok at 0.11.x and raise a error at 0.12.1
	```rust
	reqwest = { version = "~0.12.1", features = ["rustls-tls", "native-tls", "native-tls-alpn"] }
	tokio = { version = "1.36.0", features = ["full"] }
	hyper = { version = "1.2.0", features = ["server"] }
	hyper-util = { version = "0.1.3", features = ["server"] }
	http-body-util = "0.1.1"
	
	#[tokio::main]
	async fn main() {
	    let url = "https://github.com/";
	
	    let resp = reqwest::Client::builder()
	        .use_native_tls()
	        .build()
	        .unwrap()
	        .get(url)
	        .send()
	        .await
	        .unwrap();
	    println!("{:?}", resp.status());
		// it works ok at 0.11.x
		// raise a error at 0.12.1
	}
	```

2. raise a error at 0.11.x and works at 0.12.1
	```rust
	reqwest = { version = "~0.12.1", features = ["rustls-tls", "native-tls", "native-tls-alpn"] }
	tokio = { version = "1.36.0", features = ["full"] }
	hyper = { version = "1.2.0", features = ["server"] }
	hyper-util = { version = "0.1.3", features = ["server"] }
	http-body-util = "0.1.1"

	use reqwest::tls::Version;
	
	#[tokio::main]
	async fn main() {
	    let url = "https://tls-v1-2.badssl.com:1012/";
	
	    let resp = reqwest::Client::builder()
	        .use_rustls_tls()
	        .max_tls_version(Version::TLS_1_3)
	        .min_tls_version(Version::TLS_1_3)
	        .build()
	        .unwrap()
	        .get(url)
	        .send()
	        .await
	        .unwrap();
	    println!("{:?}", resp.status());
	}
	
	```


Discussion / hints:
What specifically is the error that happens?
I check and confirm that the first one has been already fixed by #2165.

Fix patch:
diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs
index faed4f6a3..079bd259d 100644
--- a/src/async_impl/client.rs
+++ b/src/async_impl/client.rs
@@ -551,9 +551,14 @@ impl ClientBuilder {
                         });
                     }
 
+                    if versions.is_empty() {
+                        return Err(crate::error::builder("empty supported tls versions"));
+                    }
+
                     // Build TLS config
                     let config_builder =
-                        rustls::ClientConfig::builder().with_root_certificates(root_cert_store);
+                        rustls::ClientConfig::builder_with_protocol_versions(&versions)
+                            .with_root_certificates(root_cert_store);
 
                     // Finalize TLS config
                     let mut tls = if let Some(id) = config.identity {
@@ -1475,6 +1480,9 @@ impl ClientBuilder {
     /// isn't supported, just that it can't be set as a maximum due to
     /// technical limitations.
     ///
+    /// Cannot set a maximum outside the protocol versions supported by
+    /// `rustls` with the `rustls-tls` backend.
+    ///
     /// # Optional
     ///
     /// This requires the optional `default-tls`, `native-tls`, or `rustls-tls(-...)`


Test patch: