Repository navigation
fix: accept zero-offset Cookie Expires dates - #1493
Merged
Merged
Conversation
Motivation: Legacy cookie expiry dates may specify UTC as -0000. The existing cookie date rules do not recognize this suffix. Modification: Extend only the cookie date rules to accept -0000. Try those rules before the shared HTTP-date rule so a supported asctime prefix does not leave the suffix unconsumed. Add positive format, canonical rendering and subsequent Path attribute coverage, and document the scoped receiver compatibility. Result: Supported cookie expiry formats retain their UTC value and following attributes. Shared HTTP date rules and existing cookie validation remain unchanged. This is not a full RFC 6265 token-parser implementation. Tests: - Five positive zero-offset cases fail against exact baseline rules. - All 14 selected positive cases pass against the final rules. - Scala 2.13.18 production compile with deprecation/import warnings fatal. - Focused MiMa 1.2.1 comparison; cached support classes, not a full build. - Scalafmt 3.11.5 and git diff --check pass. - Full sbt, Scala 3, Paradox and aggregate MiMa not run in this offline check. References: None - RFC 6265 sections 5.1.1 and 5.2.1; independent implementation informed by Netty commit edc4842309ad0491b7f2088c8116318b3d680db8.
He-Pin
marked this pull request as ready for review
November 18, 2026 06:51
pjfanning
approved these changes
Nov 18, 2026
pjfanning
left a comment
Member
There was a problem hiding this comment.
lgtm
Nits:
- The sentence added to
client-side/request-level.md(Collecting headers) feels out of place there, and the note about HTTPDate/Expiresparsing is an internal detail. I'd drop the docs change. - The PR description says the space-padded asctime day is unsupported, but
date3already accepts' ' ~ digit, soSun Nov 6 08:09:07 1994should parse.
This was referenced Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Cookie Expires dates can use the zero UTC offset -0000. Accept it in the date layouts already supported by the cookie parser.
Modification
Recognize -0000 only in the existing Cookie Expires representations, consistent with RFC 6265 section 5.1.1 interpreting the resulting date in UTC. Keep shared HTTP-Date parsing, validation and fallback behavior unchanged. Add positive cases including canonical GMT rendering and preservation of Path.
Result
Supported cookie dates with -0000 are accepted without broadening other HTTP date parsing. This is not complete RFC 6265 date-parser support.
Tests
Five selected cases failed as expected against the exact baseline; fourteen selected final positive cases passed against cached modules. Strict compilation, targeted MiMa with zero findings and git diff --check passed. Full repository CI was not run.
References
None - context: RFC 6265 section 5.1.1 and Netty 4.2 edc48423 as a test pointer. The Pekko implementation was written independently.