aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Ciro Spaciari <ciro.spaciari@gmail.com> 2023-09-13 21:48:30 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-13 21:48:30 -0700
commitfa2ef0972b11de2be5ecd5c92f13f56d6890c2ad (patch)
treeb1939d4dbd5e4ed1510e553215a46e3cc0c7223b /src
parent9976e3f528bae74667a2f4742c4b165b7f68c76d (diff)
downloadbun-fa2ef0972b11de2be5ecd5c92f13f56d6890c2ad.tar.gz
bun-fa2ef0972b11de2be5ecd5c92f13f56d6890c2ad.tar.zst
bun-fa2ef0972b11de2be5ecd5c92f13f56d6890c2ad.zip
fix(Bun.serve) fix buffering edge case (#5152)
* fix buffering clean * fix resolveMaybeNeedsTrailingSlash and try to fix ci/cd error * fix resolveMaybeNeedsTrailingSlash and try to fix ci/cd error * oops --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/api/server.zig5
-rw-r--r--src/bun.js/javascript.zig2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig
index 390f8ef96..ac0f04f34 100644
--- a/src/bun.js/api/server.zig
+++ b/src/bun.js/api/server.zig
@@ -2723,7 +2723,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp
}
pub fn doRender(this: *RequestContext) void {
- ctxLog("render", .{});
+ ctxLog("doRender", .{});
if (this.flags.aborted) {
this.finalizeForAbort();
@@ -3039,7 +3039,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp
if (last) {
var bytes = this.request_body_buf;
- defer this.request_body_buf = .{};
+
var old = body.value;
const total = bytes.items.len + chunk.len;
@@ -3070,6 +3070,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp
};
// }
}
+ this.request_body_buf = .{};
if (old == .Locked) {
var vm = this.server.vm;
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig
index 60364706e..6ce145d82 100644
--- a/src/bun.js/javascript.zig
+++ b/src/bun.js/javascript.zig
@@ -1716,7 +1716,7 @@ pub const VirtualMachine = struct {
printed,
),
};
- res.* = ErrorableString.err(error.NameTooLong, ResolveMessage.create(global, VirtualMachine.get().allocator, msg, source.utf8()).asVoid());
+ res.* = ErrorableString.err(error.NameTooLong, ResolveMessage.create(global, VirtualMachine.get().allocator, msg, source_utf8.slice()).asVoid());
return;
}