Create Client.Transfer earlier.

On client.request(req) we now immediately wrap the request into a Transfer. This
results in less copying of the Request object. It also makes the transfer.uri
available, so CDP no longer needs to std.Uri(request.url) anymore.

The main advantage is that it's easier to manage resources. There was a use-
after free before due to the sensitive nature of the tranfer's lifetime. There
were also corner cases where some resources might not be freed. This is
hopefully fixed with the lifetime of Transfer being extended.
This commit is contained in:
Karl Seguin
2025-08-13 18:05:00 +08:00
parent 2dc09c799f
commit ca9e850ac7
5 changed files with 144 additions and 108 deletions

View File

@@ -219,7 +219,7 @@ pub const Headers = struct {
return .{ .headers = header_list };
}
pub fn deinit(self: *Headers) void {
pub fn deinit(self: *const Headers) void {
c.curl_slist_free_all(self.headers);
}