mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
request url as null terminated
This commit is contained in:
@@ -44,7 +44,7 @@ pub const RequestInit = struct {
|
|||||||
const Request = @This();
|
const Request = @This();
|
||||||
|
|
||||||
method: Http.Method,
|
method: Http.Method,
|
||||||
url: []const u8,
|
url: [:0]const u8,
|
||||||
body: []const u8,
|
body: []const u8,
|
||||||
|
|
||||||
pub fn constructor(input: RequestInput, _options: ?RequestInit, page: *Page) !Request {
|
pub fn constructor(input: RequestInput, _options: ?RequestInit, page: *Page) !Request {
|
||||||
@@ -53,10 +53,10 @@ pub fn constructor(input: RequestInput, _options: ?RequestInit, page: *Page) !Re
|
|||||||
|
|
||||||
const url = blk: switch (input) {
|
const url = blk: switch (input) {
|
||||||
.string => |str| {
|
.string => |str| {
|
||||||
break :blk try URL.stitch(arena, str, page.url.raw, .{});
|
break :blk try URL.stitch(arena, str, page.url.raw, .{ .null_terminated = true });
|
||||||
},
|
},
|
||||||
.request => |req| {
|
.request => |req| {
|
||||||
break :blk try arena.dupe(u8, req.url);
|
break :blk try arena.dupeZ(u8, req.url);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -129,14 +129,14 @@ pub fn fetch(input: RequestInput, options: ?RequestInit, page: *Page) !Env.Promi
|
|||||||
|
|
||||||
const fetch_ctx = try arena.create(FetchContext);
|
const fetch_ctx = try arena.create(FetchContext);
|
||||||
fetch_ctx.* = .{
|
fetch_ctx.* = .{
|
||||||
.arena = page.arena,
|
.arena = arena,
|
||||||
.js_ctx = page.main_context,
|
.js_ctx = page.main_context,
|
||||||
.promise_resolver = v8.Persistent(v8.PromiseResolver).init(page.main_context.isolate, resolver.resolver),
|
.promise_resolver = v8.Persistent(v8.PromiseResolver).init(page.main_context.isolate, resolver.resolver),
|
||||||
};
|
};
|
||||||
|
|
||||||
try client.request(.{
|
try client.request(.{
|
||||||
.method = req.method,
|
.method = req.method,
|
||||||
.url = try arena.dupeZ(u8, req.url),
|
.url = req.url,
|
||||||
.headers = headers,
|
.headers = headers,
|
||||||
.body = req.body,
|
.body = req.body,
|
||||||
.cookie_jar = page.cookie_jar,
|
.cookie_jar = page.cookie_jar,
|
||||||
|
|||||||
Reference in New Issue
Block a user