diff --git a/desktop/Services/Agent/EdgeHttpService.cs b/desktop/Services/Agent/EdgeHttpService.cs
index d8da204..f68d554 100644
--- a/desktop/Services/Agent/EdgeHttpService.cs
+++ b/desktop/Services/Agent/EdgeHttpService.cs
@@ -602,6 +602,15 @@ public sealed class EdgeHttpService
? parsed
: 0;
+ if (contentLength == 0
+ && headers.TryGetValue("Transfer-Encoding", out var transferEncoding)
+ && transferEncoding.Contains("chunked", StringComparison.OrdinalIgnoreCase))
+ {
+ // 手写解析只认 Content-Length:真遇到 chunked 就明说,别让调用方看到「空 body」的怪错误
+ AppLog.Write($"[edge] 收到 chunked 请求 {method} {path}(不支持,请用 Content-Length)");
+ return null;
+ }
+
if (contentLength is < 0 or > MaxBodyBytes) return null;
var bodyStart = headerEnd + 4;
diff --git a/desktop/Services/Edge/EdgeClient.cs b/desktop/Services/Edge/EdgeClient.cs
index 9f555d8..c65f669 100644
--- a/desktop/Services/Edge/EdgeClient.cs
+++ b/desktop/Services/Edge/EdgeClient.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Net.Http.Json;
+using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
@@ -215,7 +216,13 @@ public sealed class EdgeClient : IDisposable
if (payload is not null)
{
- request.Content = JsonContent.Create(payload, options: HikWorkerJson.Options);
+ // ⚠️ 不能用 JsonContent.Create:它不带 Content-Length(走 chunked),
+ // 而边端是手写的 HTTP 读取、只认 Content-Length,会把 body 读成空 → 400。
+ // 先用 StringContent 序列化成带长度的请求。
+ request.Content = new StringContent(
+ JsonSerializer.Serialize(payload, HikWorkerJson.Options),
+ Encoding.UTF8,
+ "application/json");
}
try
diff --git a/desktop/YuncangTrace.LocalService.csproj b/desktop/YuncangTrace.LocalService.csproj
index dd2a7d9..74c7f5f 100644
--- a/desktop/YuncangTrace.LocalService.csproj
+++ b/desktop/YuncangTrace.LocalService.csproj
@@ -42,7 +42,7 @@
http://127.0.0.1:7300
https://packs.example.com
- 1.0.109
+ 1.0.110
浜戜粨瑙嗛婧簮杞欢
浜戜粨
浜戜粨瑙嗛婧簮杞欢锛堟湰鏈烘湇鍔★級