mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 17:07:47 +00:00
Browser+LibWeb: Move the cookie structure into LibWeb
This commit is contained in:
parent
c2d38abe6f
commit
7193e518d1
4 changed files with 52 additions and 16 deletions
|
@ -157,7 +157,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie& parsed_cookie, const URL
|
|||
// https://tools.ietf.org/html/rfc6265#section-5.3
|
||||
|
||||
// 2. Create a new cookie with name cookie-name, value cookie-value. Set the creation-time and the last-access-time to the current date and time.
|
||||
Cookie cookie { move(parsed_cookie.name), move(parsed_cookie.value) };
|
||||
Web::Cookie::Cookie cookie { move(parsed_cookie.name), move(parsed_cookie.value) };
|
||||
cookie.creation_time = Core::DateTime::now();
|
||||
cookie.last_access_time = cookie.creation_time;
|
||||
|
||||
|
|
|
@ -31,24 +31,11 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibWeb/Cookie/Cookie.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Browser {
|
||||
|
||||
struct Cookie {
|
||||
String name;
|
||||
String value;
|
||||
Core::DateTime creation_time {};
|
||||
Core::DateTime last_access_time {};
|
||||
Core::DateTime expiry_time {};
|
||||
String domain {};
|
||||
String path {};
|
||||
bool secure { false };
|
||||
bool http_only { false };
|
||||
bool host_only { false };
|
||||
bool persistent { false };
|
||||
};
|
||||
|
||||
struct CookieStorageKey {
|
||||
bool operator==(const CookieStorageKey&) const = default;
|
||||
|
||||
|
@ -71,7 +58,7 @@ private:
|
|||
void store_cookie(Web::Cookie::ParsedCookie& parsed_cookie, const URL& url, String canonicalized_domain);
|
||||
void purge_expired_cookies();
|
||||
|
||||
HashMap<CookieStorageKey, Cookie> m_cookies;
|
||||
HashMap<CookieStorageKey, Web::Cookie::Cookie> m_cookies;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue