Allow Request#getDateHeader to parse dates in RFC 9651 Structured Field Values format - #1054
Open
sabberworm wants to merge 3 commits into
Open
Allow Request#getDateHeader to parse dates in RFC 9651 Structured Field Values format#1054sabberworm wants to merge 3 commits into
sabberworm wants to merge 3 commits into
Conversation
sabberworm
commented
Aug 27, 2026
sabberworm
commented
Aug 27, 2026
sabberworm
commented
Aug 27, 2026
| } | ||
| date = httpParseFormats[i].tryParseDate(value); | ||
| } | ||
| updateParseCache(value, Long.valueOf(date)); |
Author
There was a problem hiding this comment.
Now this is also called for values that failed to parse. Not sure if that’s better or worse. IMHO it makes sense to also cache these, since they’re the most expensive to calculate as they have to be tried (and rejected) by all the parsers.
sabberworm
commented
Aug 27, 2026
| * Tries to parse the given string as a date and returns it as a timestamp. | ||
| * | ||
| * @param dateString the string representation of the date trying to be parsed | ||
| * @return the number of *milli*seconds since January 1, 1970, 00:00:00 GMT or -1 if parsing failed |
Author
There was a problem hiding this comment.
Suggested change
| * @return the number of *milli*seconds since January 1, 1970, 00:00:00 GMT or -1 if parsing failed | |
| * @return the number of <em>milli</em>seconds since January 1, 1970, 00:00:00 GMT or -1 if parsing failed |
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.
RFC 9651 (Structured Field Values for HTTP) defines formats for header values of specific types. The format it uses for dates is
@«timestamp», which is different from other date headers.This PR aims to support the date header format from RFC 9651 in
org.apache.catalina.connector.Request#getDateHeader(String).