This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 728e2e605a Use a valid date format for the expires attribute of a
cookie
728e2e605a is described below
commit 728e2e605a01f214c458566d76200b56dcfb7464
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Oct 12 19:28:03 2022 +0100
Use a valid date format for the expires attribute of a cookie
Note: The format used prior to this change is not listed as a valid
format in any of the relevant specifications.
---
java/org/apache/tomcat/util/http/CookieProcessorBase.java | 2 +-
.../apache/tomcat/util/http/TestCookieProcessorGeneration.java | 2 +-
webapps/docs/changelog.xml | 9 +++++++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/tomcat/util/http/CookieProcessorBase.java
b/java/org/apache/tomcat/util/http/CookieProcessorBase.java
index 47fbe58f69..5c3b08bfd9 100644
--- a/java/org/apache/tomcat/util/http/CookieProcessorBase.java
+++ b/java/org/apache/tomcat/util/http/CookieProcessorBase.java
@@ -24,7 +24,7 @@ import java.util.TimeZone;
public abstract class CookieProcessorBase implements CookieProcessor {
- private static final String COOKIE_DATE_PATTERN = "EEE, dd-MMM-yyyy
HH:mm:ss z";
+ private static final String COOKIE_DATE_PATTERN = "EEE, dd MMM yyyy
HH:mm:ss z";
protected static final ThreadLocal<DateFormat> COOKIE_DATE_FORMAT =
ThreadLocal.withInitial(() -> {
diff --git
a/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
b/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
index 3ec05ae3a2..b74a851a16 100644
--- a/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
+++ b/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
@@ -102,7 +102,7 @@ public class TestCookieProcessorGeneration {
@Test
public void testMaxAgeZero() {
- doTestMaxAge(0, "foo=bar; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10
GMT");
+ doTestMaxAge(0, "foo=bar; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:10
GMT");
}
@Test
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7f4dc123d8..c42a13b3f7 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,15 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 10.1.2 (markt)" rtext="in development">
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ Correct the date format used with the expires attribute of HTTP
cookies.
+ A single space rather than a single dash should be used to separate the
+ day, month and year components to be compliant with RFC 6265. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Other">
<changelog>
<update>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]