This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push:
new 2286276 Allow http response date field set to older date
2286276 is described below
commit 22862766981076d0800aa01cac2e6eda175a6eba
Author: zhenguoli <[email protected]>
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 f052474..932208b 100644
--- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
+++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
@@ -94,7 +94,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 cf4b3c8..1b7aac1 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: [email protected]
For additional commands, e-mail: [email protected]