This is an automated email from the ASF dual-hosted git repository.

remm 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 847c78a1aa Return the full range with weak etags
847c78a1aa is described below

commit 847c78a1aab12986af96ebce7294c8d2618c36d6
Author: remm <r...@apache.org>
AuthorDate: Mon Mar 3 12:09:32 2025 +0100

    Return the full range with weak etags
---
 java/org/apache/catalina/servlets/DefaultServlet.java             | 2 +-
 .../apache/catalina/servlets/TestDefaultServletRangeRequests.java | 2 +-
 webapps/docs/changelog.xml                                        | 8 ++++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index da19889906..7fe25f2328 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -2532,7 +2532,7 @@ public class DefaultServlet extends HttpServlet {
             }
             // If the ETag the client gave does not match the entity
             // etag, then the entire entity is returned.
-            if (resourceETag != null && resourceETag.equals(headerValue)) {
+            if (!weakETag && resourceETag != null && 
resourceETag.equals(headerValue)) {
                 return true;
             } else {
                 return false;
diff --git 
a/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java 
b/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java
index 4fb3952531..e59534b5f9 100644
--- a/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java
+++ b/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java
@@ -123,7 +123,7 @@ public class TestDefaultServletRangeRequests extends 
TomcatBaseTest {
                 "bytes=0-9", FastHttpDateFormat.formatDate(1000), 
Integer.valueOf(200), strLen, "" });
         // Valid weak etag
         parameterSets.add(new Object[] {
-                "bytes=0-9", weakETag, Integer.valueOf(206), "10", "0-9/" + 
len });
+                "bytes=0-9", weakETag, Integer.valueOf(200), strLen, "" });
         // Invalid strong etag
         parameterSets.add(new Object[] {
                 "bytes=0-9", "\"46273648\"", Integer.valueOf(200), strLen, "" 
});
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e709c84cfb..25ae463719 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.102 (remm)" rtext="in development">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Weak etags in the <code>If-Range</code> header should not match as
+        strong etags are required. (remm)
+      </fix>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 9.0.101 (remm)" rtext="release in progress">
   <subsection name="Catalina">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to