You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/02/10 17:26:14 UTC
[tomcat] branch 9.0.x updated: Allow http response date field set to older date
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 11b19fd Allow http response date field set to older date
11b19fd is described below
commit 11b19fd861231dfe256c024fdcc3cdb6dc7e17b3
Author: zhenguoli <zh...@yandex.com>
AuthorDate: Wed Jan 19 22:18:42 2022 +0800
Allow http response date field set to older date
---
java/org/apache/tomcat/util/http/FastHttpDateFormat.java | 3 ++-
webapps/docs/changelog.xml | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
index a546ee6..73c578e 100644
--- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
+++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
@@ -103,7 +103,8 @@ public final class FastHttpDateFormat {
*/
public static final String getCurrentDate() {
long now = System.currentTimeMillis();
- if ((now - currentDateGenerated) > 1000) {
+ // Handle case where time moves backwards (e.g. system time corrected)
+ if (Math.abs(now - currentDateGenerated) > 1000) {
currentDate = FORMAT_RFC5322.format(new Date(now));
currentDateGenerated = now;
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b7bfc09..5b1e395 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,12 @@
OpenSSL for TLS between MacOS and Linux/Windows as the root cause was
traced to configuration differences. (markt)
</fix>
+ <fix>
+ <pr>467</pr>: When system time moves backwards (e.g. after clock
+ correction), ensure that the cached formatted current date used for
+ HTTP headers tracks this change. Pull request provided by zhenguoli.
+ (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Web applications">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org