HttpClient Improvements

1 - Track owner of a request (for simpler / more accurate abort (TBD))

2 - Create Transfer upfront, make everything work on Transfer (not Request)
    This helps remove ambiguity about cleanup and simplifies layers. For example
    Robots request is just another normal request, not a special case. This gives
    everything a stable address (the *Transfer which can be looked up by id)
This commit is contained in:
Karl Seguin committed 2026-05-12 19:26:24 +08:00
1 parent 49297d76d3
commit 82a4fc752b
20 files changed
+550 -528

No files matched your search

+6 -8
View File
@@ -21,9 +21,7 @@ const lp = @import("lightpanda");
const Frame = @import("browser/Frame.zig");
const Transfer = @import("browser/HttpClient.zig").Transfer;
const Request = @import("browser/HttpClient.zig").Request;
const Response = @import("browser/HttpClient.zig").Response;
const InterceptContext = @import("network/layer/InterceptionLayer.zig").InterceptContext;
const log = lp.log;
const List = std.DoublyLinkedList;
@@ -170,11 +168,11 @@ pub const FrameLoaded = struct {
};
pub const RequestStart = struct {
request: *Request,
transfer: *Transfer,
};
pub const RequestIntercept = struct {
request: *Request,
transfer: *Transfer,
wait_for_interception: *bool,
};
@@ -185,21 +183,21 @@ pub const RequestAuthRequired = struct {
pub const ResponseData = struct {
data: []const u8,
request: *Request,
transfer: *Transfer,
};
pub const ResponseHeaderDone = struct {
request: *Request,
transfer: *Transfer,
response: *const Response,
};
pub const RequestDone = struct {
request: *Request,
transfer: *Transfer,
content_length: usize,
};
pub const RequestFail = struct {
request: *Request,
transfer: *Transfer,
err: anyerror,
};