diff options
author | 2023-09-07 18:01:07 -0400 | |
---|---|---|
committer | 2023-09-07 18:01:07 -0400 | |
commit | 2c88a1138a056e086aff614874996276260b8327 (patch) | |
tree | d5c82cfdaeca7cb3b28eadcd7c0286f5d8f45b01 /src | |
parent | 0a125c514d8e0cabd2e6a8b1cbf6887f97399b1a (diff) | |
download | bun-2c88a1138a056e086aff614874996276260b8327.tar.gz bun-2c88a1138a056e086aff614874996276260b8327.tar.zst bun-2c88a1138a056e086aff614874996276260b8327.zip |
metadata can be null and restore fn fail
Diffstat (limited to 'src')
-rw-r--r-- | src/http_client_async.zig | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig index f06474219..01419cafd 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -1324,10 +1324,7 @@ pub const InternalState = struct { reader.deinit(); } - // if we are holding a cloned_metadata we need to deinit it - // this should never happen because we should always return the metadata to the user - std.debug.assert(this.cloned_metadata == null); - // just in case we check and free to avoid leaks + if (this.cloned_metadata != null) { this.cloned_metadata.?.deinit(allocator); this.cloned_metadata = null; @@ -2865,10 +2862,6 @@ fn fail(this: *HTTPClient, err: anyerror) void { if (this.signals.aborted != null) { _ = socket_async_http_abort_tracker.swapRemove(this.async_http_id); } - - this.state.reset(this.allocator); - this.proxy_tunneling = false; - this.state.request_stage = .fail; this.state.response_stage = .fail; this.state.fail = err; @@ -2876,6 +2869,9 @@ fn fail(this: *HTTPClient, err: anyerror) void { const callback = this.result_callback; const result = this.toResult(); + this.state.reset(this.allocator); + this.proxy_tunneling = false; + callback.run(result); } |