-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: testIssues in the test moduleIssues in the test modulestatus: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: regressionA bug that is also a regressionA bug that is also a regression
Milestone
Description
After upgrading to Spring 5.2.1 many unit tests mocking responses using Spring's MockHttpServletResponse which set a Set-Cookie header including Expires=0 suddenly fail like this:
java.time.format.DateTimeParseException: Text '0' could not be parsed at index 1
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1948)
at java.base/java.time.ZonedDateTime.parse(ZonedDateTime.java:598)
at org.springframework.mock.web.MockCookie.parse(MockCookie.java:122)
The reason seems to be the current implementation of following new feature: Preserve expires attribute in MockCookie #23769, which according to my understanding does not correctly handle all Cookie attribute values of the Expires attribute.
See also RFC 2616 14.21, RFC 6265 5.3, and RFC 7234 5.3.
A cache recipient MUST interpret invalid date formats, especially the value "0", as representing a time in the past (i.e., "already expired").
Relevant commit introducing the regression: 9b20876
I think a parse error should at least be caught and ignored here.
Metadata
Metadata
Assignees
Labels
in: testIssues in the test moduleIssues in the test modulestatus: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: regressionA bug that is also a regressionA bug that is also a regression