try safer http cleanup on page deinit

This commit is contained in:
Karl Seguin
2025-12-02 16:05:57 +08:00
parent a61e87c5dd
commit b5eceb52fb
3 changed files with 24 additions and 1 deletions

View File

@@ -153,7 +153,7 @@ pub fn abort(self: *Client) void {
log.err(.http, "get private info", .{ .err = err, .source = "abort" });
continue;
};
transfer.abort();
transfer.kill();
}
std.debug.assert(self.active == 0);
@@ -812,6 +812,15 @@ pub const Transfer = struct {
self.deinit();
}
// internal, when the page is shutting down. Doesn't have the same ceremony
// as abort (doesn't send a notification, doesn't invoke an error callback)
fn kill(self: *Transfer) void {
if (self._handle != null) {
self.client.endTransfer(self);
}
self.deinit();
}
// abortAuthChallenge is called when an auth chanllenge interception is
// abort. We don't call self.client.endTransfer here b/c it has been done
// before interception process.