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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 2408097cb8 send Allow header at same time with sc "Method not allowed" 
(#804)
2408097cb8 is described below

commit 2408097cb86ec140c1a0a56ecb9f2dfb632def07
Author: Chenjp <ch...@msn.com>
AuthorDate: Tue Jan 21 16:57:42 2025 +0800

    send Allow header at same time with sc "Method not allowed" (#804)
    
    comply rfc 9110 Section 15.5.6. 405 Method Not Allowed
---
 java/org/apache/catalina/servlets/DefaultServlet.java | 2 +-
 webapps/docs/changelog.xml                            | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 648a8c597d..27ad57a172 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -744,7 +744,7 @@ public class DefaultServlet extends HttpServlet {
             if (resource.delete()) {
                 resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
             } else {
-                resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+                sendNotAllowed(req, resp);
             }
         } else {
             resp.sendError(HttpServletResponse.SC_NOT_FOUND);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7a136f0e75..58db4a3865 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -159,6 +159,12 @@
         <code>true</code>, ensure that the destination for any requested WebDAV
         operation is also restricted to the sub-path. (markt)
       </fix>
+      <fix>
+        Generate an appropriate <code>Allow</code> HTTP header when the Default
+        servlet returns a 405 (method not allowed) response in response to a
+        <code>DELETE</code> request because the target resource cannot be
+        deleted. Pull request <pr>802</pr> provided by Chenjp. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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

Reply via email to