This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new c0f4a49271 Fix two minor issues in ExpiresFilter
c0f4a49271 is described below
commit c0f4a49271b228d071c4ae5ece9cf938f3155bdf
Author: remm <[email protected]>
AuthorDate: Thu May 21 12:02:32 2026 +0200
Fix two minor issues in ExpiresFilter
---
java/org/apache/catalina/filters/ExpiresFilter.java | 10 ++++++----
webapps/docs/changelog.xml | 8 ++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java
b/java/org/apache/catalina/filters/ExpiresFilter.java
index b07f0c85b9..acb505ad63 100644
--- a/java/org/apache/catalina/filters/ExpiresFilter.java
+++ b/java/org/apache/catalina/filters/ExpiresFilter.java
@@ -458,7 +458,7 @@ public class ExpiresFilter extends FilterBase {
/** Day duration unit. */
DAY(Calendar.DAY_OF_YEAR),
/** Hour duration unit. */
- HOUR(Calendar.HOUR),
+ HOUR(Calendar.HOUR_OF_DAY),
/** Minute duration unit. */
MINUTE(Calendar.MINUTE),
/** Month duration unit. */
@@ -586,9 +586,11 @@ public class ExpiresFilter extends FilterBase {
@Override
public void addDateHeader(String name, long date) {
super.addDateHeader(name, date);
- if (!lastModifiedHeaderSet) {
- this.lastModifiedHeader = date;
- this.lastModifiedHeaderSet = true;
+ if (HEADER_LAST_MODIFIED.equalsIgnoreCase(name)) {
+ if (!lastModifiedHeaderSet) {
+ this.lastModifiedHeader = date;
+ this.lastModifiedHeaderSet = true;
+ }
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 317099f167..fafe3bcd76 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -252,6 +252,14 @@
<fix>
Fix container event cleanups in some edge cases. (remm)
</fix>
+ <fix>
+ Check for last-modified header in <code>ExpiresFilter</code> when a
+ servlet uses <code>addDateHader</code> to avoid wrongly considering
+ it has been set. (remm)
+ </fix>
+ <fix>
+ Fix hour unit used by <code>ExpiresFilter</code>. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]