This commit is contained in:
sjorsdonkers
2025-06-13 09:45:57 +02:00
committed by Sjors
parent 30ee41fd0e
commit 3f4338cb51
2 changed files with 5 additions and 5 deletions

View File

@@ -312,7 +312,7 @@ pub const Cookie = struct {
@memcpy(s[1..], d); @memcpy(s[1..], d);
break :blk s; break :blk s;
} else blk: { } else blk: {
break :blk try aa.dupe(u8, host); break :blk try aa.dupe(u8, host); // Sjors: Should subdomains be removed from host?
}; };
_ = toLower(owned_domain); _ = toLower(owned_domain);

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2023-2024 Lightpanda (Selecy SAS) // Copyright (C) 2023-2025 Lightpanda (Selecy SAS)
// //
// Francis Bouvier <francis@lightpanda.io> // Francis Bouvier <francis@lightpanda.io>
// Pierre Tachoire <pierre@lightpanda.io> // Pierre Tachoire <pierre@lightpanda.io>
@@ -68,8 +68,8 @@ fn getCookies(cmd: anytype) !void {
} }
} }
bc.session.cookie_jar.removeExpired(null); bc.session.cookie_jar.removeExpired(null);
const cookies = CookieWriter{ .cookies = bc.session.cookie_jar.cookies.items }; const writer = CookieWriter{ .cookies = bc.session.cookie_jar.cookies.items };
try cmd.sendResult(.{ .cookies = cookies }, .{}); try cmd.sendResult(.{ .cookies = writer }, .{});
} }
fn setCookies(cmd: anytype) !void { fn setCookies(cmd: anytype) !void {
@@ -143,7 +143,7 @@ pub fn setCdpCookie(cookie_jar: *CookieJar, param: CdpCookie) !void {
// NOTE: The param.url can affect the default domain, path, source port, and source scheme. // NOTE: The param.url can affect the default domain, path, source port, and source scheme.
const uri = if (param.url) |url| std.Uri.parse(url) catch return error.InvalidParams else null; const uri = if (param.url) |url| std.Uri.parse(url) catch return error.InvalidParams else null;
const domain = try percentEncodedDomainOrHost(a, uri, param.domain) orelse return error.InvalidParams; const domain = try percentEncodedDomainOrHost(a, uri, param.domain) orelse return error.InvalidParams; // TODO Domain needs to be prefixed with a dot if is explicitely set
const cookie = Cookie{ const cookie = Cookie{
.arena = arena, .arena = arena,