Repository navigation
Add tests for mismatched weekdays in cookie Expires dates - #949
Conversation
|
@DicksonWu654 Please rebase off the latest master. |
|
Done, rebased onto master! Full httpclient5 verify passes locally |
2905ccb to
c045e98
Compare
|
@DicksonWu654 Do you think we could make this logic conditional on |
c045e98 to
0befc7e
Compare
|
Good call! Turns out RELAXED already does this - it uses LaxExpiresHandler, which ignores the weekday. So with STRICT unchanged there's nothing left to change in the parser. I've cut the PR down to tests that pin both behaviors: STRICT rejects a mismatched weekday, RELAXED accepts it and sets the expiry. Full httpclient5 verify passes. Happy to close it instead if you'd rather not carry the extra tests |
RFC 6265 section 5.1.1 parses a cookie date from its time, day-of-month, month and year tokens and never compares the weekday name against the date. In
StandardCookieSpec.RELAXEDmodeRFC6265LaxSpecusesLaxExpiresHandler, which follows that algorithm and ignores the weekday. InStandardCookieSpec.STRICTmodeBasicExpiresHandlerwithDateUtils.STANDARD_PATTERNSchecks it, soExpires=Mon, 01 Jan 2030 00:00:00 GMT(a Tuesday) is rejected.Per review, STRICT keeps that behavior, so this PR only adds tests that pin both modes: STRICT (and
BasicExpiresHandler) reject a mismatched weekday, and RELAXED accepts it and sets the expiry to2030-01-01T00:00:00Z.This was the third of the three cookie items from the dev@hc.apache.org thread.
./mvnw -pl httpclient5 -am verifyon master (900bcb9) passes: 1166 tests, with Checkstyle and RAT passing.