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

markt 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 4ed62bfd9f send Allow header at same time with sc "Method not allowed" 
(#804)
4ed62bfd9f is described below

commit 4ed62bfd9f8c868ca844a9c6f464ceaa5a6f3c23
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 1c56e31f26..3642176e01 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -734,7 +734,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 6da7454e46..d85bd59da1 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