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

remm 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 92585e67e4 Fix check order
92585e67e4 is described below

commit 92585e67e48c6ebe9ff28871865e4a08ea4e4a36
Author: remm <r...@apache.org>
AuthorDate: Wed Dec 11 19:07:52 2024 +0100

    Fix check order
---
 java/org/apache/catalina/servlets/DefaultServlet.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 260a767d12..ceaca1d164 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -2067,6 +2067,11 @@ public class DefaultServlet extends HttpServlet {
     protected boolean checkIfMatch(HttpServletRequest request, 
HttpServletResponse response, WebResource resource)
             throws IOException {
 
+        boolean conditionSatisfied = false;
+        Enumeration<String> headerValues = request.getHeaders("If-Match");
+        if (!headerValues.hasMoreElements()) {
+            return true;
+        }
         String resourceETag = generateETag(resource);
         if (resourceETag == null) {
             // if a current representation for the target resource is not 
present
@@ -2074,11 +2079,6 @@ public class DefaultServlet extends HttpServlet {
             return false;
         }
 
-        boolean conditionSatisfied = false;
-        Enumeration<String> headerValues = request.getHeaders("If-Match");
-        if (!headerValues.hasMoreElements()) {
-            return true;
-        }
         boolean hasAsteriskValue = false;// check existence of special header 
value '*'
         int headerCount = 0;
         while (headerValues.hasMoreElements() && !conditionSatisfied) {


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

Reply via email to