mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-06 20:02:49 +08:00
feat(http): reqwest 客户端启用 brotli / deflate 解码
对接部分 provider 时会返回 Content-Encoding: br / deflate, 缺少对应 feature 时 reqwest 只能按压缩字节原样交给调用方, 导致 text() 解码异常或 body 看似为空。显式开启两项 feature, 让所有标准压缩响应都可被正常还原。
This commit is contained in:
1
src-tauri/Cargo.lock
generated
1
src-tauri/Cargo.lock
generated
@@ -406,6 +406,7 @@ version = "0.4.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb7b51a7d9c967fc26773061ba86150f19c50c0d65c887cb1fbe295fd16619b7"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"compression-core",
|
||||
"flate2",
|
||||
"memchr",
|
||||
|
||||
@@ -23,7 +23,7 @@ serde_json = "1"
|
||||
dirs = "6"
|
||||
chrono = "0.4"
|
||||
zip = { version = "2", default-features = false, features = ["deflate"] }
|
||||
reqwest = { version = "0.12", features = ["json", "rustls-tls", "stream", "gzip"], default-features = false }
|
||||
reqwest = { version = "0.12", features = ["json", "rustls-tls", "stream", "gzip", "brotli", "deflate"], default-features = false }
|
||||
futures-util = "0.3"
|
||||
ed25519-dalek = { version = "2", features = ["rand_core"] }
|
||||
sha2 = "0.10"
|
||||
|
||||
@@ -357,7 +357,11 @@ fn build_http_client_opt(
|
||||
user_agent: Option<&str>,
|
||||
use_proxy: bool,
|
||||
) -> Result<reqwest::Client, String> {
|
||||
let mut builder = reqwest::Client::builder().timeout(timeout).gzip(true);
|
||||
let mut builder = reqwest::Client::builder()
|
||||
.timeout(timeout)
|
||||
.gzip(true)
|
||||
.brotli(true)
|
||||
.deflate(true);
|
||||
if let Some(ua) = user_agent {
|
||||
builder = builder.user_agent(ua);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user