From c3da803439476502b58f532eec33db443c88c6a7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 06:18:59 +0000 Subject: [PATCH 1/2] Initial plan From 3e5c2866ebb1d1edbf6786a5da867bb5627f1400 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 06:20:58 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20HTTP=20spec=20violation:=20check=20ch?= =?UTF-8?q?unked=20before=20content=5Flength=20per=20RFC=207230=20=C2=A73.?= =?UTF-8?q?3.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: dragosv <422243+dragosv@users.noreply.github.com> --- src/docker_client.zig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/docker_client.zig b/src/docker_client.zig index 493edf3..bfca19d 100644 --- a/src/docker_client.zig +++ b/src/docker_client.zig @@ -182,7 +182,13 @@ fn parseResponseHead(reader: *HttpReader) !ResponseMeta { } /// Read the full response body according to the parsed metadata. +/// Per RFC 7230 §3.3.3, Transfer-Encoding takes precedence over Content-Length +/// when both are present. fn readResponseBody(reader: *HttpReader, meta: ResponseMeta, allocator: std.mem.Allocator) ![]const u8 { + if (meta.chunked) { + return readChunkedBody(reader, allocator); + } + if (meta.content_length) |cl| { if (cl == 0) return allocator.dupe(u8, ""); const body_buf = try allocator.alloc(u8, cl); @@ -191,10 +197,6 @@ fn readResponseBody(reader: *HttpReader, meta: ResponseMeta, allocator: std.mem. return body_buf; } - if (meta.chunked) { - return readChunkedBody(reader, allocator); - } - // No Content-Length and not chunked — read until connection close. return readUntilClose(reader, allocator); }