From 680dc78dac6591b253473e5786d0bae9af8d7186 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 17 Jun 2026 15:42:38 +0100 Subject: [PATCH] LibHTTP: Reuse cookie domain attribute parsing The Cookie to ParsedCookie conversion stripped a leading dot and lowercased the cookie domain itself. Use the existing Domain attribute parser instead, so edited cookies follow the same ASCII validation and normalization as Set-Cookie parsing. --- Libraries/LibHTTP/Cookie/ParsedCookie.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Libraries/LibHTTP/Cookie/ParsedCookie.cpp b/Libraries/LibHTTP/Cookie/ParsedCookie.cpp index 769a016ea3..c4f0a39dcb 100644 --- a/Libraries/LibHTTP/Cookie/ParsedCookie.cpp +++ b/Libraries/LibHTTP/Cookie/ParsedCookie.cpp @@ -111,12 +111,8 @@ ErrorOr parse_cookie(Cookie const& cookie) parsed_cookie.secure_attribute_present = cookie.secure; parsed_cookie.http_only_attribute_present = cookie.http_only; - if (!cookie.host_only) { - auto domain = cookie.domain.bytes_as_string_view(); - if (domain.starts_with('.')) - domain = domain.substring_view(1); - parsed_cookie.domain = domain.to_ascii_lowercase_string(); - } + if (!cookie.host_only) + TRY(on_domain_attribute(parsed_cookie, cookie.domain.bytes_as_string_view())); if (cookie.persistent) parsed_cookie.expiry_time_from_expires_attribute = cookie.expiry_time;