diff --git a/lib/std/http/Client.zig b/lib/std/http/Client.zig index 010c557f87..41f199a094 100644 --- a/lib/std/http/Client.zig +++ b/lib/std/http/Client.zig @@ -856,7 +856,7 @@ pub const Request = struct { /// Finish the body of a request. This notifies the server that you have no more data to send. pub fn finish(req: *Request) !void { switch (req.headers.transfer_encoding) { - .chunked => req.connection.data.conn.writeAll("0\r\n") catch |err| { + .chunked => req.connection.data.conn.writeAll("0\r\n\r\n") catch |err| { req.client.last_error = .{ .write = err }; return error.WriteFailed; }, diff --git a/lib/std/http/Server.zig b/lib/std/http/Server.zig index 85fbf25265..1ecb8fbd69 100644 --- a/lib/std/http/Server.zig +++ b/lib/std/http/Server.zig @@ -517,7 +517,7 @@ pub const Response = struct { /// Finish the body of a request. This notifies the server that you have no more data to send. pub fn finish(res: *Response) !void { switch (res.headers.transfer_encoding) { - .chunked => try res.connection.writeAll("0\r\n"), + .chunked => try res.connection.writeAll("0\r\n\r\n"), .content_length => |len| if (len != 0) return error.MessageNotCompleted, .none => {}, }