diff options
author | 2022-09-19 05:50:10 -0700 | |
---|---|---|
committer | 2022-09-19 05:50:10 -0700 | |
commit | 9754c5b32b268a1869d3e54f81b0af87b1880390 (patch) | |
tree | 9941f748fde6a93bf46da885ba1e2c42413c97b6 /src | |
parent | a16cb394231b47f3567cf07ed41085d46ebd2d3b (diff) | |
download | bun-9754c5b32b268a1869d3e54f81b0af87b1880390.tar.gz bun-9754c5b32b268a1869d3e54f81b0af87b1880390.tar.zst bun-9754c5b32b268a1869d3e54f81b0af87b1880390.zip |
Fix larger bodies
Diffstat (limited to 'src')
-rw-r--r-- | src/http_client_async.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig index 567f92be6..3ba0c0b7c 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -1215,6 +1215,7 @@ pub fn onWritable(this: *HTTPClient, comptime is_first_call: bool, comptime is_s if (this.state.request_body.len > 0 and list.capacity - list.items.len > 0) { var remain = list.items.ptr[list.items.len..list.capacity]; const wrote = @minimum(remain.len, this.state.request_body.len); + std.debug.assert(wrote > 0); @memcpy(remain.ptr, this.state.request_body.ptr, wrote); list.items.len += wrote; } @@ -1254,6 +1255,11 @@ pub fn onWritable(this: *HTTPClient, comptime is_first_call: bool, comptime is_s if (has_sent_headers) { this.state.request_stage = .body; std.debug.assert(this.state.request_body.len > 0); + + // we sent everything, but there's some body leftover + if (amount == @intCast(c_int, to_send.len)) { + this.onWritable(false, is_ssl, socket); + } } else { this.state.request_stage = .headers; } |