From 3a50ae92ec8f58226bdf06ebd2b97b5e1d94fd69 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Sun, 18 Sep 2022 04:00:40 -0700 Subject: [PATCH] Fix broken sending http body --- src/http_client_async.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/http_client_async.zig b/src/http_client_async.zig index 2ee1e4e6fc..567f92be62 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -1214,7 +1214,9 @@ pub fn onWritable(this: *HTTPClient, comptime is_first_call: bool, comptime is_s std.debug.assert(list.items.len == writer.context.items.len); if (this.state.request_body.len > 0 and list.capacity - list.items.len > 0) { var remain = list.items.ptr[list.items.len..list.capacity]; - @memcpy(remain.ptr, this.state.request_body.ptr, @minimum(remain.len, this.state.request_body.len)); + const wrote = @minimum(remain.len, this.state.request_body.len); + @memcpy(remain.ptr, this.state.request_body.ptr, wrote); + list.items.len += wrote; } const to_send = list.items[this.state.request_sent_len..];