Lightpanda: the headless browser designed for AI and automation
cookie: match the UTC zone case-insensitively
Jay Hemnani58fac2771de4
diff --git a/src/browser/webapi/storage/Cookie.zig b/src/browser/webapi/storage/Cookie.zigindex c6886a8ce..112fb31e3 100644--- a/src/browser/webapi/storage/Cookie.zig+++ b/src/browser/webapi/storage/Cookie.zig@@ -221,7 +221,7 @@ pub fn parse(allocator: Allocator, url: [:0]const u8, str: []const u8) !Cookie {var exp_dt = DateTime.parse(expires_, .rfc822) catch null;if (exp_dt == null) {const dashed = expires_.len > 11 and expires_[7] == '-' and expires_[11] == '-';- const utc = std.mem.endsWith(u8, expires_, " UTC");+ const utc = std.ascii.endsWithIgnoreCase(expires_, " utc");if (dashed or utc) {// Replace dashes and a "UTC" zone, and try againconst output = try aa.dupe(u8, expires_);@@ -1445,6 +1445,8 @@ test "Cookie: parse expires" {try expectAttribute(.{ .expires = 1918798080 }, null, "b;expires=Wed, 21 Oct 2030 07:28:00 UTC");try expectAttribute(.{ .expires = 1784275395 }, null, "b;expires=Fri, 17-Jul-2026 08:03:15 UTC");try expectAttribute(.{ .expires = 0 }, null, "b;expires=Thu, 01 Jan 1970 00:00:00 UTC");+ try expectAttribute(.{ .expires = 1918798080 }, null, "b;expires=Wed, 21 Oct 2030 07:28:00 utc");+ try expectAttribute(.{ .expires = 1784275395 }, null, "b;expires=Fri, 17-Jul-2026 08:03:15 Utc");// max-age has priority over expirestry expectAttribute(.{ .expires = lp.datetime.timestamp(.real) + 10 }, null, "b;Max-Age=10; expires=Wed, 21 Oct 2030 07:28:00 GMT");}