diff options
author | 2023-09-30 22:59:42 -0700 | |
---|---|---|
committer | 2023-09-30 22:59:42 -0700 | |
commit | e020ecec1596192b6e6ffe8453094e37e95a85ef (patch) | |
tree | a78d1e91e9e15a6934d0dd8626b6f6072c7bfba2 /src/http_client_async.zig | |
parent | 8775d3755974831dc2676ed155808a973a6352aa (diff) | |
download | bun-e020ecec1596192b6e6ffe8453094e37e95a85ef.tar.gz bun-e020ecec1596192b6e6ffe8453094e37e95a85ef.tar.zst bun-e020ecec1596192b6e6ffe8453094e37e95a85ef.zip |
Fix bug causing "Connection Refused" errors (#6206)
* Loop through the return values of getaddrinfo
* Remove incorrect assertion
* Remove extra check
* Remove extra check
* Update bsd.c
* More consistent
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/http_client_async.zig')
-rw-r--r-- | src/http_client_async.zig | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig index 1e0ba7cc0..6c731acd5 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -1343,7 +1343,7 @@ pub const InternalState = struct { return this.transfer_encoding == Encoding.chunked; } - pub fn reset(this: *InternalState, buffering: bool, allocator: std.mem.Allocator) void { + pub fn reset(this: *InternalState, allocator: std.mem.Allocator) void { this.compressed_body.deinit(); this.response_message_buffer.deinit(); @@ -1354,12 +1354,6 @@ pub const InternalState = struct { reader.deinit(); } - if (!buffering) { - // 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); @@ -2186,7 +2180,7 @@ pub fn doRedirect(this: *HTTPClient) void { this.fail(error.TooManyRedirects); return; } - this.state.reset(this.signals.isEmpty(), this.allocator); + this.state.reset(this.allocator); // also reset proxy to redirect this.proxy_tunneling = false; if (this.proxy_tunnel != null) { @@ -2907,7 +2901,7 @@ fn fail(this: *HTTPClient, err: anyerror) void { _ = socket_async_http_abort_tracker.swapRemove(this.async_http_id); } - this.state.reset(this.signals.isEmpty(), this.allocator); + this.state.reset(this.allocator); this.proxy_tunneling = false; this.state.request_stage = .fail; @@ -2993,7 +2987,7 @@ pub fn progressUpdate(this: *HTTPClient, comptime is_ssl: bool, ctx: *NewHTTPCon socket.close(0, null); } - this.state.reset(this.signals.isEmpty(), this.allocator); + this.state.reset(this.allocator); this.state.response_stage = .done; this.state.request_stage = .done; this.state.stage = .done; |