re-enable http/2 support

This commit is contained in:
Gregory Schier
2025-07-27 07:38:12 -07:00
parent b445261b32
commit 93c6f6d611
2 changed files with 6 additions and 3 deletions

View File

@@ -49,7 +49,7 @@ log = "0.4.27"
md5 = "0.8.0" md5 = "0.8.0"
mime_guess = "2.0.5" mime_guess = "2.0.5"
rand = "0.9.0" rand = "0.9.0"
reqwest = { workspace = true, features = ["multipart", "cookies", "gzip", "brotli", "deflate", "json", "rustls-tls-manual-roots-no-provider", "socks"] } reqwest = { workspace = true, features = ["multipart", "cookies", "gzip", "brotli", "deflate", "json", "rustls-tls-manual-roots-no-provider", "socks", "http2"] }
reqwest_cookie_store = { workspace = true } reqwest_cookie_store = { workspace = true }
serde = { workspace = true, features = ["derive"] } serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["raw_value"] } serde_json = { workspace = true, features = ["raw_value"] }

View File

@@ -10,7 +10,7 @@ pub fn get_config(validate_certificates: bool) -> ClientConfig {
let config_builder = ClientConfig::builder_with_provider(arc_crypto_provider) let config_builder = ClientConfig::builder_with_provider(arc_crypto_provider)
.with_safe_default_protocol_versions() .with_safe_default_protocol_versions()
.unwrap(); .unwrap();
if validate_certificates { let mut client = if validate_certificates {
// Use platform-native verifier to validate certificates // Use platform-native verifier to validate certificates
config_builder.with_platform_verifier().unwrap().with_no_client_auth() config_builder.with_platform_verifier().unwrap().with_no_client_auth()
} else { } else {
@@ -18,7 +18,10 @@ pub fn get_config(validate_certificates: bool) -> ClientConfig {
.dangerous() .dangerous()
.with_custom_certificate_verifier(Arc::new(NoVerifier)) .with_custom_certificate_verifier(Arc::new(NoVerifier))
.with_no_client_auth() .with_no_client_auth()
} };
// Required for http/2 support
client.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
client
} }
// Copied from reqwest: https://github.com/seanmonstar/reqwest/blob/595c80b1fbcdab73ac2ae93e4edc3406f453df25/src/tls.rs#L608 // Copied from reqwest: https://github.com/seanmonstar/reqwest/blob/595c80b1fbcdab73ac2ae93e4edc3406f453df25/src/tls.rs#L608