Skip to content

Commit c88bc65

Browse files
committed
cookie: use a ; w/o space for cookie separator in requests
1 parent 37340dc commit c88bc65

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/storage/cookie.zig

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub const Jar = struct {
145145
if (first) {
146146
first = false;
147147
} else {
148-
try writer.writeAll(", ");
148+
try writer.writeAll("; ");
149149
}
150150
try writeCookie(cookie, writer);
151151
}
@@ -563,8 +563,8 @@ test "Jar: forRequest" {
563563
try jar.add(try Cookie.parse(testing.allocator, &test_uri_2, "domain1=9;domain=test.lightpanda.io"), now);
564564

565565
// nothing fancy here
566-
try expectCookies("global1=1, global2=2", &jar, test_uri, .{});
567-
try expectCookies("global1=1, global2=2", &jar, test_uri, .{ .origin_uri = &test_uri, .navigation = false });
566+
try expectCookies("global1=1; global2=2", &jar, test_uri, .{});
567+
try expectCookies("global1=1; global2=2", &jar, test_uri, .{ .origin_uri = &test_uri, .navigation = false });
568568

569569
// We have a cookie where Domain=lightpanda.io
570570
// This should _not_ match xyxlightpanda.io
@@ -573,47 +573,47 @@ test "Jar: forRequest" {
573573
});
574574

575575
// matching path without trailing /
576-
try expectCookies("global1=1, global2=2, path1=3", &jar, try std.Uri.parse("http://lightpanda.io/about"), .{
576+
try expectCookies("global1=1; global2=2; path1=3", &jar, try std.Uri.parse("http://lightpanda.io/about"), .{
577577
.origin_uri = &test_uri,
578578
});
579579

580580
// incomplete prefix path
581-
try expectCookies("global1=1, global2=2", &jar, try std.Uri.parse("http://lightpanda.io/abou"), .{
581+
try expectCookies("global1=1; global2=2", &jar, try std.Uri.parse("http://lightpanda.io/abou"), .{
582582
.origin_uri = &test_uri,
583583
});
584584

585585
// path doesn't match
586-
try expectCookies("global1=1, global2=2", &jar, try std.Uri.parse("http://lightpanda.io/aboutus"), .{
586+
try expectCookies("global1=1; global2=2", &jar, try std.Uri.parse("http://lightpanda.io/aboutus"), .{
587587
.origin_uri = &test_uri,
588588
});
589589

590590
// path doesn't match cookie directory
591-
try expectCookies("global1=1, global2=2", &jar, try std.Uri.parse("http://lightpanda.io/docs"), .{
591+
try expectCookies("global1=1; global2=2", &jar, try std.Uri.parse("http://lightpanda.io/docs"), .{
592592
.origin_uri = &test_uri,
593593
});
594594

595595
// exact directory match
596-
try expectCookies("global1=1, global2=2, path2=4", &jar, try std.Uri.parse("http://lightpanda.io/docs/"), .{
596+
try expectCookies("global1=1; global2=2; path2=4", &jar, try std.Uri.parse("http://lightpanda.io/docs/"), .{
597597
.origin_uri = &test_uri,
598598
});
599599

600600
// sub directory match
601-
try expectCookies("global1=1, global2=2, path2=4", &jar, try std.Uri.parse("http://lightpanda.io/docs/more"), .{
601+
try expectCookies("global1=1; global2=2; path2=4", &jar, try std.Uri.parse("http://lightpanda.io/docs/more"), .{
602602
.origin_uri = &test_uri,
603603
});
604604

605605
// secure
606-
try expectCookies("global1=1, global2=2, secure=5", &jar, try std.Uri.parse("https://lightpanda.io/"), .{
606+
try expectCookies("global1=1; global2=2; secure=5", &jar, try std.Uri.parse("https://lightpanda.io/"), .{
607607
.origin_uri = &test_uri,
608608
});
609609

610610
// navigational cross domain, secure
611-
try expectCookies("global1=1, global2=2, secure=5, sitenone=6, sitelax=7", &jar, try std.Uri.parse("https://lightpanda.io/x/"), .{
611+
try expectCookies("global1=1; global2=2; secure=5; sitenone=6; sitelax=7", &jar, try std.Uri.parse("https://lightpanda.io/x/"), .{
612612
.origin_uri = &(try std.Uri.parse("https://example.com/")),
613613
});
614614

615615
// navigational cross domain, insecure
616-
try expectCookies("global1=1, global2=2, sitelax=7", &jar, try std.Uri.parse("http://lightpanda.io/x/"), .{
616+
try expectCookies("global1=1; global2=2; sitelax=7", &jar, try std.Uri.parse("http://lightpanda.io/x/"), .{
617617
.origin_uri = &(try std.Uri.parse("https://example.com/")),
618618
});
619619

@@ -630,18 +630,18 @@ test "Jar: forRequest" {
630630
});
631631

632632
// non-navigational same origin
633-
try expectCookies("global1=1, global2=2, sitelax=7, sitestrict=8", &jar, try std.Uri.parse("http://lightpanda.io/x/"), .{
633+
try expectCookies("global1=1; global2=2; sitelax=7; sitestrict=8", &jar, try std.Uri.parse("http://lightpanda.io/x/"), .{
634634
.origin_uri = &(try std.Uri.parse("https://lightpanda.io/")),
635635
.navigation = false,
636636
});
637637

638638
// exact domain match + suffix
639-
try expectCookies("global2=2, domain1=9", &jar, try std.Uri.parse("http://test.lightpanda.io/"), .{
639+
try expectCookies("global2=2; domain1=9", &jar, try std.Uri.parse("http://test.lightpanda.io/"), .{
640640
.origin_uri = &test_uri,
641641
});
642642

643643
// domain suffix match + suffix
644-
try expectCookies("global2=2, domain1=9", &jar, try std.Uri.parse("http://1.test.lightpanda.io/"), .{
644+
try expectCookies("global2=2; domain1=9", &jar, try std.Uri.parse("http://1.test.lightpanda.io/"), .{
645645
.origin_uri = &test_uri,
646646
});
647647

0 commit comments

Comments
 (0)