mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
http: add an arena to Transfer
This commit is contained in:
@@ -236,6 +236,7 @@ fn makeTransfer(self: *Client, req: Request) !*Transfer {
|
|||||||
const id = self.next_request_id + 1;
|
const id = self.next_request_id + 1;
|
||||||
self.next_request_id = id;
|
self.next_request_id = id;
|
||||||
transfer.* = .{
|
transfer.* = .{
|
||||||
|
.arena = ArenaAllocator.init(self.allocator),
|
||||||
.id = id,
|
.id = id,
|
||||||
.uri = uri,
|
.uri = uri,
|
||||||
.req = req,
|
.req = req,
|
||||||
@@ -534,6 +535,7 @@ pub const Request = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub const Transfer = struct {
|
pub const Transfer = struct {
|
||||||
|
arena: ArenaAllocator,
|
||||||
id: usize = 0,
|
id: usize = 0,
|
||||||
req: Request,
|
req: Request,
|
||||||
uri: std.Uri, // used for setting/getting the cookie
|
uri: std.Uri, // used for setting/getting the cookie
|
||||||
@@ -553,6 +555,7 @@ pub const Transfer = struct {
|
|||||||
if (self._handle) |handle| {
|
if (self._handle) |handle| {
|
||||||
self.client.handles.release(handle);
|
self.client.handles.release(handle);
|
||||||
}
|
}
|
||||||
|
self.arena.deinit();
|
||||||
self.client.transfer_pool.destroy(self);
|
self.client.transfer_pool.destroy(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,7 +644,7 @@ pub const Transfer = struct {
|
|||||||
if (transfer._redirecting and buf_len == 2) {
|
if (transfer._redirecting and buf_len == 2) {
|
||||||
// parse and set cookies for the redirection.
|
// parse and set cookies for the redirection.
|
||||||
redirectionCookies(
|
redirectionCookies(
|
||||||
transfer.client.arena.allocator(),
|
transfer.arena.allocator(),
|
||||||
easy,
|
easy,
|
||||||
transfer.req.cookie_jar,
|
transfer.req.cookie_jar,
|
||||||
&transfer.uri,
|
&transfer.uri,
|
||||||
|
|||||||
Reference in New Issue
Block a user