Implement cookie expiry date parsing algorithm (#37715)

The cookie-rs library parses the cookie expiry date based on the format
from RFC 2616 (for HTTP/1.1), which is stricter than the format from RFC
6265 (for HTTP cookie).

This patch implements the cookie expiry date algorithm from RFC 6265.
When Cookie::parse fails in parsing the expiry date, we try to parse the
expiry again with this algorithm, to provide extra compatibility with
legacy systems.

Testing: Pass a WPT test that was expected to fail before, and add a
unit test.
Fixes: #36452

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This commit is contained in:
Kingsley Yung 2025-07-11 13:18:11 +08:00 committed by GitHub
parent 099d20fe94
commit 464d71ecfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 310 additions and 6 deletions

View file

@ -92,7 +92,7 @@ metrics = { path = "../metrics" }
mime = { workspace = true }
mime_guess = { workspace = true }
net_traits = { workspace = true }
nom = "7.1.3"
nom = { workspace = true }
num-traits = { workspace = true }
num_cpus = { workspace = true }
parking_lot = { workspace = true }