fix(network): limit text response bodies to 4 MiB

Closes #8344
Closes #8359
This commit is contained in:
Tunglies
2026-11-08 10:18:37 +08:00
parent 51fff78287
commit 884aa24677
4 changed files with 8 additions and 0 deletions
Generated
+1
View File
@@ -1107,6 +1107,7 @@ dependencies = [
"futures",
"gethostname",
"getrandom 0.4.3",
"http-body-util",
"libc",
"log",
"nanoid",
+1
View File
@@ -25,6 +25,7 @@
<summary><strong> 🐞 修复问题 </strong></summary>
- 修复检测更新后又发布新版时,应用内更新失败
- 修复订阅响应过大导致内存占用过高,限制单次下载为 4 MiB
- 修复全局模式默认停在 `DIRECT` 或 `REJECT` 导致流量未经代理,现自动切换到第一个策略组
- 修复订阅中未加引号的 REALITY `short-id`(如 `1234e123`)被误读为数字,导致订阅无法启用
+1
View File
@@ -64,6 +64,7 @@ dunce = "1.0.5"
nanoid = "0.5"
chrono = { workspace = true }
boa_engine = "0.22.0"
http-body-util = "0.1.4"
percent-encoding = "2.3.2"
reqwest = { workspace = true }
sysproxy = { git = "https://github.com/clash-verge-rev/sysproxy-rs.git", branch = "main", features = [
+5
View File
@@ -228,6 +228,11 @@ impl NetworkManager {
}
};
let response: tauri::http::Response<reqwest::Body> = response.into();
let response = reqwest::Response::from(
response.map(|body| reqwest::Body::wrap(http_body_util::Limited::new(body, 4 * 1024 * 1024))),
);
let status = response.status();
let headers = response.headers().to_owned();
let body = match response.text().await {