Skip to content

Commit b1483a7

Browse files
committed
request url as null terminated
1 parent 78e7482 commit b1483a7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/browser/fetch/Request.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub const RequestInit = struct {
4444
const Request = @This();
4545

4646
method: Http.Method,
47-
url: []const u8,
47+
url: [:0]const u8,
4848
body: []const u8,
4949

5050
pub fn constructor(input: RequestInput, _options: ?RequestInit, page: *Page) !Request {
@@ -53,10 +53,10 @@ pub fn constructor(input: RequestInput, _options: ?RequestInit, page: *Page) !Re
5353

5454
const url = blk: switch (input) {
5555
.string => |str| {
56-
break :blk try URL.stitch(arena, str, page.url.raw, .{});
56+
break :blk try URL.stitch(arena, str, page.url.raw, .{ .null_terminated = true });
5757
},
5858
.request => |req| {
59-
break :blk try arena.dupe(u8, req.url);
59+
break :blk try arena.dupeZ(u8, req.url);
6060
},
6161
};
6262

@@ -129,14 +129,14 @@ pub fn fetch(input: RequestInput, options: ?RequestInit, page: *Page) !Env.Promi
129129

130130
const fetch_ctx = try arena.create(FetchContext);
131131
fetch_ctx.* = .{
132-
.arena = page.arena,
132+
.arena = arena,
133133
.js_ctx = page.main_context,
134134
.promise_resolver = v8.Persistent(v8.PromiseResolver).init(page.main_context.isolate, resolver.resolver),
135135
};
136136

137137
try client.request(.{
138138
.method = req.method,
139-
.url = try arena.dupeZ(u8, req.url),
139+
.url = req.url,
140140
.headers = headers,
141141
.body = req.body,
142142
.cookie_jar = page.cookie_jar,

0 commit comments

Comments
 (0)