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

markt 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 eecaf57d60 Remove unnecessary code
eecaf57d60 is described below

commit eecaf57d60ad9a1f928b9875c41d04b8fba6b3cd
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Dec 12 11:54:41 2024 +0000

    Remove unnecessary code
---
 java/org/apache/catalina/servlets/DefaultServlet.java | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index fa9cf5366f..fc6f58014e 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -2293,14 +2293,13 @@ public class DefaultServlet extends HttpServlet {
         }
 
         try {
+            // Header is present so -1 will be not returned. Only a valid date 
or an IAE are possible.
             long headerValue = request.getDateHeader("If-Unmodified-Since");
-            if (headerValue != -1) {
-                if (resourceLastModified >= (headerValue + 1000)) {
-                    // The entity has not been modified since the date
-                    // specified by the client. This is not an error case.
-                    
response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);
-                    return false;
-                }
+            if (resourceLastModified >= (headerValue + 1000)) {
+                // The entity has not been modified since the date
+                // specified by the client. This is not an error case.
+                response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);
+                return false;
             }
         } catch (IllegalArgumentException illegalArgument) {
             return true;


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

Reply via email to