CookiesManager加载已保存Cookie遇无效日期格式问题求助及解决记录
I ran into a frustrating issue recently when trying to load saved cookies into a CookiesManager—kept getting the error Invalid Cookies Date format.
Here's one of the cookie entries I was working with initially:
ds_user_id=7459742257; Path=/; Domain=Testing.com; Max-Age=7775999; Expires=Sat, 07-Jul-2018 17:52:03 GMT
At first, I had no clue what was causing the problem. After digging through all my saved cookie items, I finally found the culprit: another cookie with an absurdly far-future expiration date:
rur=FTW; Path=/; Domain=Testing.com; Max-Age=251879107499; Expires=Sat, 01-Jan-10000 06:59:59 GMT
The issue boiled down to the year 10000 in the Expires field. It turns out the CookiesManager's date parsing logic can't handle such an oversized year value. Once I modified the year to a reasonable value like 2019, the cookies loaded successfully without any errors.
Relevant code snippet (Delphi):
var S: string; Cookies: TIdCookieList; // Rest of the cookie loading implementation here
内容的提问来源于stack exchange,提问作者Mr.Mark

