This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 78ff9acf7c Fix two minor issues in ExpiresFilter
78ff9acf7c is described below
commit 78ff9acf7c7feb163436d3ba50bbce995537bb56
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 75ec59c9bf..dd8038a98d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,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]