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

markt-asf 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 c555b97a79 Correctly handle a TRACE request for a resource that does 
not exist
c555b97a79 is described below

commit c555b97a7946359608b66fa2053ca8ed7ac9c59a
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Nov 4 11:25:42 2026 +0000

    Correctly handle a TRACE request for a resource that does not exist
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 05dcad99cc..6875a82ac1 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -840,10 +840,13 @@ public class CoyoteAdapter implements Adapter {
                     }
                 }
             }
-            if (header != null) {
+            if (header == null) {
+                // No header, means no wrapper which means no matching 
resource so need to return 404.
+                response.sendError(404);
+            } else {
                 res.addHeader("Allow", header.toString());
+                response.sendError(405, sm.getString("coyoteAdapter.trace"));
             }
-            response.sendError(405, sm.getString("coyoteAdapter.trace"));
             // Safe to skip the remainder of this method.
             return true;
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to