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
pjfanning
added a commit
that referenced
this pull request
Nov 19, 2026
Motivation: Several recently merged PRs left review points unaddressed: docs that were asked to be dropped, comments and tests that were suggested, and small API and internal tidy-ups. Modification: - Add a Scala FilenameEncoding alias and values to Multipart.FormData and use them in the Scala toEntity signature and tests (#1494). - Render the form-data Content-Disposition header directly instead of rendering it twice and slicing off the prefix (#1494). - Drop the docs paragraph about unpaired URI surrogates (#1426) and the cookie -0000 sentence in request-level.md (#1493). - Fix the javadsl Multipart.FormData doc the same way #1483 fixed the scaladsl one. - Comment the cookie date rule copies so they stay in sync (#1458). - Test custom methods starting with Q next to the QUERY fast path (#1477). - Use one root package import and a dilated timeout in HeaderCompressionSpec (#1438). - Pass isTrailer to HttpMessageRendering.renderHeaders explicitly (#1463). - Remove the unused forwarding overloads in Handshake.Client and EnabledPingState (#1436, #1462). - Move the media type model checks from the routing spec to a new http-core MediaTypesSpec (#1437, #1454). - Hash the WebSocket key without String.valueOf (#1439). Result: The review points are addressed. The only public API change is the added Scala FilenameEncoding alias. Tests: - http-core/testOnly MultipartSpec MultipartsSpec MediaTypesSpec RequestParserCRLFSpec RequestParserLFSpec HeaderCompressionSpec WebSocketClientSpec HeaderSpec HttpHeaderSpec: 314 passed - http2-tests/testOnly HttpMessageRenderingSpec Http2PingSchedulingSpec: 38 passed - http-tests/testOnly FileAndResourceDirectivesSpec: 63 passed - http-core/mimaReportBinaryIssues: passed References: Refs #1426, #1436, #1437, #1438, #1439, #1454, #1458, #1462, #1463, #1477, #1483, #1493, #1494
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.