Skip to content

Commit f7eee0d

Browse files
committed
http: add an arena to Transfer
1 parent 39178d8 commit f7eee0d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/http/Client.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ fn makeTransfer(self: *Client, req: Request) !*Transfer {
236236
const id = self.next_request_id + 1;
237237
self.next_request_id = id;
238238
transfer.* = .{
239+
.arena = ArenaAllocator.init(self.allocator),
239240
.id = id,
240241
.uri = uri,
241242
.req = req,
@@ -534,6 +535,7 @@ pub const Request = struct {
534535
};
535536

536537
pub const Transfer = struct {
538+
arena: ArenaAllocator,
537539
id: usize = 0,
538540
req: Request,
539541
uri: std.Uri, // used for setting/getting the cookie
@@ -553,6 +555,7 @@ pub const Transfer = struct {
553555
if (self._handle) |handle| {
554556
self.client.handles.release(handle);
555557
}
558+
self.arena.deinit();
556559
self.client.transfer_pool.destroy(self);
557560
}
558561

@@ -641,7 +644,7 @@ pub const Transfer = struct {
641644
if (transfer._redirecting and buf_len == 2) {
642645
// parse and set cookies for the redirection.
643646
redirectionCookies(
644-
transfer.client.arena.allocator(),
647+
transfer.arena.allocator(),
645648
easy,
646649
transfer.req.cookie_jar,
647650
&transfer.uri,

0 commit comments

Comments
 (0)