feat: add http2 support to reqwest client and update dependencies

main
Yoo1tic 2025-07-20 01:19:32 +08:00
parent 2974b7df5b
commit b77b27b8ec
3 changed files with 42 additions and 2 deletions

40
Cargo.lock generated
View File

@ -113,6 +113,12 @@ dependencies = [
"bytemuck",
]
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "backon"
version = "1.5.1"
@ -441,6 +447,25 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "h2"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17da50a276f1e01e0ba6c029e47b7100754904ee8a278f886546e98575380785"
dependencies = [
"atomic-waker",
"bytes",
"fnv",
"futures-core",
"futures-sink",
"http",
"indexmap",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]]
name = "hashbrown"
version = "0.15.4"
@ -502,6 +527,7 @@ dependencies = [
"bytes",
"futures-channel",
"futures-util",
"h2",
"http",
"http-body",
"httparse",
@ -1014,6 +1040,7 @@ dependencies = [
"base64",
"bytes",
"futures-core",
"h2",
"http",
"http-body",
"http-body-util",
@ -1339,6 +1366,19 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
]
[[package]]
name = "toml"
version = "0.8.23"

View File

@ -9,7 +9,7 @@ backon = "1"
clap = { version = "4.5", features = ["derive"] }
futures = "0.3"
regex = "1.11"
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls","http2"] }
serde_json = "1.0"
tokio = { version = "1.46", features = [
"macros",

View File

@ -11,7 +11,7 @@ pub fn client_builder(config: &KeyCheckerConfig) -> Result<Client, reqwest::Erro
let mut builder = Client::builder()
.timeout(Duration::from_secs(config.timeout_sec))
.pool_max_idle_per_host(pool_size)
.pool_idle_timeout(Duration::from_secs(30));
.http2_prior_knowledge();
if let Some(ref proxy_url) = config.proxy {
builder = builder.proxy(reqwest::Proxy::all(proxy_url.clone())?);