mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
Browser: Process Secure and HttpOnly cookie attributes
This commit is contained in:
parent
db24186309
commit
e0f9ed01c7
Notes:
sideshowbarker
2024-07-18 20:29:49 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/e0f9ed01c70 Pull-request: https://github.com/SerenityOS/serenity/pull/6259
|
@ -221,9 +221,9 @@ void CookieJar::process_attribute(Cookie& cookie, StringView attribute_name, Str
|
|||
} else if (attribute_name.equals_ignoring_case("Path")) {
|
||||
on_path_attribute(cookie, attribute_value);
|
||||
} else if (attribute_name.equals_ignoring_case("Secure")) {
|
||||
on_secure_attribute(cookie, attribute_value);
|
||||
on_secure_attribute(cookie);
|
||||
} else if (attribute_name.equals_ignoring_case("HttpOnly")) {
|
||||
on_http_only_attribute(cookie, attribute_value);
|
||||
on_http_only_attribute(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,14 +291,16 @@ void CookieJar::on_path_attribute(Cookie& cookie, StringView attribute_value)
|
|||
cookie.path = attribute_value;
|
||||
}
|
||||
|
||||
void CookieJar::on_secure_attribute([[maybe_unused]] Cookie& cookie, [[maybe_unused]] StringView attribute_value)
|
||||
void CookieJar::on_secure_attribute(Cookie& cookie)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.2.5
|
||||
cookie.secure = true;
|
||||
}
|
||||
|
||||
void CookieJar::on_http_only_attribute([[maybe_unused]] Cookie& cookie, [[maybe_unused]] StringView attribute_value)
|
||||
void CookieJar::on_http_only_attribute(Cookie& cookie)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.2.6
|
||||
cookie.http_only = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ struct Cookie {
|
|||
Core::DateTime expiry_time {};
|
||||
String domain {};
|
||||
String path {};
|
||||
bool secure { false };
|
||||
bool http_only { false };
|
||||
};
|
||||
|
||||
class CookieJar {
|
||||
|
@ -57,8 +59,8 @@ private:
|
|||
static void on_max_age_attribute(Cookie& cookie, StringView attribute_value);
|
||||
static void on_domain_attribute(Cookie& cookie, StringView attribute_value);
|
||||
static void on_path_attribute(Cookie& cookie, StringView attribute_value);
|
||||
static void on_secure_attribute(Cookie& cookie, StringView attribute_value);
|
||||
static void on_http_only_attribute(Cookie& cookie, StringView attribute_value);
|
||||
static void on_secure_attribute(Cookie& cookie);
|
||||
static void on_http_only_attribute(Cookie& cookie);
|
||||
|
||||
HashMap<String, Vector<Cookie>> m_cookies;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue