Skip to content

Lightpanda: the headless browser designed for AI and automation

robots, mem: don't buffer body on a non-200 robots response

Karl Seguin042e85e80729
diff --git a/src/network/RobotsGate.zig b/src/network/RobotsGate.zig
index 6767a00ec..6ae9b7caf 100644
--- a/src/network/RobotsGate.zig
+++ b/src/network/RobotsGate.zig
@@ -216,7 +216,9 @@ const RobotsContext = struct {
fn dataCallback(transfer: *Transfer, data: []const u8) anyerror!void {
const self: *RobotsContext = @ptrCast(@alignCast(transfer.req.ctx));
- try self.buffer.appendSlice(self.arena, data);
+ if (self.status == 200) {
+ try self.buffer.appendSlice(self.arena, data);
+ }
}
fn doneCallback(ctx_ptr: *anyopaque) anyerror!void {