Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/docker_client.zig
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,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);
Expand Down