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

markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 35e1592d7c Correctly handle a TRACE request for a resource that does 
not exist
35e1592d7c is described below

commit 35e1592d7c013cda30bef8501e9887d04dd5faa3
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 08ab9850b2..40bf38746a 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -834,10 +834,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