This is an automated email from the ASF dual-hosted git repository.
rmaucher 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 e059115b74 Fix two minor issues in ExpiresFilter
e059115b74 is described below
commit e059115b74c672af4922dc5a18b7031e9597316a
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 cb3edca7f1..d99556f796 100644
--- a/java/org/apache/catalina/filters/ExpiresFilter.java
+++ b/java/org/apache/catalina/filters/ExpiresFilter.java
@@ -466,7 +466,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. */
@@ -606,9 +606,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 a3915907a8..e7384b91c0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -144,6 +144,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]