remove cors req from single flight on transfer deinit

This commit is contained in:
Muki Kiboigo
2026-07-23 15:31:41 -07:00
parent 84065f14a5
commit 92f2646d9b
2 changed files with 12 additions and 4 deletions

View File

@@ -104,6 +104,10 @@ fn keyFor(arena: Allocator, transfer: *Transfer) ![]const u8 {
);
}
pub fn remove(self: *CorsGate, transfer: *Transfer) void {
self.single_flight.remove(transfer);
}
pub fn check(self: *CorsGate, transfer: *Transfer) !Result {
if (transfer.req.resource_type == .document) return .allowed;
if (URL.isSameOrigin(transfer.req.url, transfer.req.cookie_origin)) return .allowed;

View File

@@ -2138,10 +2138,14 @@ pub const Transfer = struct {
self._dispatch_queued = false;
}
// And for the robots gate: RobotsGate.pending holds a raw *Transfer
// while we're parked.
if (self.state == .parked and self.state.parked == .robots) {
self.client.robots.remove(self);
// And for the robots/cors gates: their single_flight.pending holds a raw
// *Transfer while we're parked.
if (self.state == .parked) {
switch (self.state.parked) {
.robots => self.client.robots.remove(self),
.cors => self.client.cors.remove(self),
.intercept_request, .intercept_auth => {},
}
}
// A pending revalidation entry owns cache resources (possibly an