From 7518ee9e87eef265bad719cee268a290b53c37a8 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:56:14 +0400 Subject: [PATCH] fix: prevent duplicate header --- src-tauri/src/proxy_server.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src-tauri/src/proxy_server.rs b/src-tauri/src/proxy_server.rs index 8e65211..19f759a 100644 --- a/src-tauri/src/proxy_server.rs +++ b/src-tauri/src/proxy_server.rs @@ -508,6 +508,13 @@ async fn handle_http_via_socks4( { continue; } + // Skip Content-Length and Transfer-Encoding - we'll add our own Content-Length + // based on the collected body size. Having both violates HTTP/1.1 (RFC 7230). + if name.as_str().eq_ignore_ascii_case("content-length") + || name.as_str().eq_ignore_ascii_case("transfer-encoding") + { + continue; + } if let Ok(val) = value.to_str() { http_request.push_str(&format!("{}: {}\r\n", name.as_str(), val)); }