1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

Browser: Change value of "the latest representable date" for cookies

Setting the year to NumericLimits<unsigned>::max() resulted in the
following datetime: -2-12-31 00:00:00.

Instead, set the latest datetime to the last second of the year 9999.
This commit is contained in:
Timothy Flynn 2021-04-12 12:15:57 -04:00 committed by Andreas Kling
parent 5496d71e4a
commit d363ed8872

View file

@ -26,7 +26,6 @@
#include "CookieJar.h"
#include <AK/AllOf.h>
#include <AK/NumericLimits.h>
#include <AK/StringBuilder.h>
#include <AK/URL.h>
#include <ctype.h>
@ -180,7 +179,7 @@ Optional<Cookie> CookieJar::parse_cookie(const String& cookie_string, String def
// 6. The cookie-name is the name string, and the cookie-value is the value string.
Cookie cookie { name, value };
cookie.expiry_time = Core::DateTime::create(AK::NumericLimits<unsigned>::max());
cookie.expiry_time = Core::DateTime::create(9999, 12, 31, 23, 59, 59);
cookie.domain = move(default_domain);
cookie.path = move(default_path);