mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 01:25:53 -04:00
fire RobotsBlocked in nextTickRun
This commit is contained in:
@@ -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 => {},
|
||||
|
||||
Reference in New Issue
Block a user