diff options
author | 2022-09-18 04:00:40 -0700 | |
---|---|---|
committer | 2022-09-18 04:00:40 -0700 | |
commit | 3a50ae92ec8f58226bdf06ebd2b97b5e1d94fd69 (patch) | |
tree | 9f3cfbfa2846fa8c05e5a8b3d079810343f7e4b2 | |
parent | fe77f6a2f3f4b90943123414f7dd21e6c68fa523 (diff) | |
download | bun-3a50ae92ec8f58226bdf06ebd2b97b5e1d94fd69.tar.gz bun-3a50ae92ec8f58226bdf06ebd2b97b5e1d94fd69.tar.zst bun-3a50ae92ec8f58226bdf06ebd2b97b5e1d94fd69.zip |
Fix broken sending http body
-rw-r--r-- | src/http_client_async.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig index 2ee1e4e6f..567f92be6 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..]; |