cookie: ignore case when comparing with localhost domain

Co-authored-by: Karl Seguin <karlseguin@users.noreply.github.com>
This commit is contained in:
Pierre Tachoire
2025-05-27 14:31:59 +02:00
committed by GitHub
parent c6f23eee77
commit b731fa4b78

View File

@@ -358,7 +358,7 @@ pub const Cookie = struct {
value = value[1..];
}
if (std.mem.indexOfScalarPos(u8, value, 0, '.') == null and std.mem.eql(u8, "localhost", value) == false) {
if (std.mem.indexOfScalarPos(u8, value, 0, '.') == null and std.ascii.eqlIgnoreCase("localhost", value) == false) {
// can't set a cookie for a TLD
return error.InvalidDomain;
}