fire RobotsBlocked in nextTickRun

This commit is contained in:
Muki Kiboigo committed 2026-06-05 07:25:32 -07:00
1 parent ffcdcc6e09
commit 572267802d
1 file changed
+15 -2
+15 -2
View File
@@ -70,8 +70,21 @@ fn request(ptr: *anyopaque, transfer: *Transfer) anyerror!void {
const path = URL.getPathname(url);
if (!robots.isAllowed(path)) {
log.warn(.http, "blocked by robots", .{ .url = url });
return error.RobotsBlocked;
try transfer.client.runNextTick(
transfer,
null,
.{
.run = struct {
fn run(t: *Transfer, _: ?*anyopaque) void {
defer t.deinit();
log.warn(.http, "blocked by robots", .{ .url = t.req.url });
t.req.error_callback(t.req.ctx, error.RobotsBlocked);
}
}.run,
},
);
return;
}
},
.absent => {},