Repository navigation
Fix cookie with an epoch Expires date not being deleted - #14064
spicysharkco wants to merge 2 commits into
Conversation
CookieJar treated `Expires=Thu, 01 Jan 1970 00:00:00 GMT` as an invalid date, because `_parse_date()` returns 0 for it and the result was only checked for truthiness. The cookie was kept as a session cookie instead of being deleted. Compare against None instead.
Automation signalsActivity patterns show signs of automation. Evidence
Last 5 PRs: This is an automated analysis by AgentScan |
This comment has been minimized.
This comment has been minimized.
[Medium impact] This PR appears safe to merge. Reviews (1) · Last reviewed commit: "Add changelog entry" · Reviewed by Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #14064 +/- ##
=======================================
Coverage 99.09% 99.09%
=======================================
Files 135 135
Lines 53551 53557 +6
Branches 2809 2809
=======================================
+ Hits 53067 53073 +6
Misses 364 364
Partials 120 120
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance
|
What do these changes do?
CookieJarignoredExpires=Thu, 01 Jan 1970 00:00:00 GMT._parse_date()returns0for that date and_update_cookies()only tested the result for truthiness, so the date counted as invalid and the cookie was stored as a session cookie instead of being deleted. It now compares againstNone.Tested with
test_cookie_jar_epoch_expires_deletes_cookie, which fails without the change (assert 1 == 0) and passes with it.Are there changes in behavior for the user?
A
Set-CookiewhoseExpiresis exactly the epoch now removes the cookie, like any other past date orMax-Age=0already does. The same line is in the 3.14 and 3.15 branches.Is it a substantial burden for the maintainers to support this?
No, it is a one-line change.
Related issue number
None filed.
Checklist
CONTRIBUTORS.txtCHANGES/folder