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-connectors.git

commit f96af6255aa1d2c861796d01268a182a7b8f79d3
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Sep 4 23:02:47 2023 +0100

    Fix BZ 65901 - don't generate response bodies for HEAD requests
---
 native/apache-2.0/mod_jk.c        | 9 +++++----
 xdocs/miscellaneous/changelog.xml | 5 +++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/native/apache-2.0/mod_jk.c b/native/apache-2.0/mod_jk.c
index 228229edf..720d7f7fa 100644
--- a/native/apache-2.0/mod_jk.c
+++ b/native/apache-2.0/mod_jk.c
@@ -3013,10 +3013,11 @@ static int jk_handler(request_rec * r)
                     JK_TRACE_EXIT(l);
                     return s.http_response_status;
                 }
-                /* If tomcat returned no body and the status is not OK,
-                   let apache handle the error code */
-
-                if (!r->sent_bodyct && r->status >= HTTP_BAD_REQUEST) {
+                /*
+                 * If Tomcat returned no body, the status is not OK and it is
+                 * not a HEAD request, let httpd generate the response body.
+                 */
+                if (!r->sent_bodyct && r->status >= HTTP_BAD_REQUEST && 
strcmp(r->method, "HEAD")) {
                     jk_log(l, JK_LOG_INFO, "No body with status=%d"
                            " for worker=%s",
                            r->status, worker_name);
diff --git a/xdocs/miscellaneous/changelog.xml 
b/xdocs/miscellaneous/changelog.xml
index b66963805..4d103383d 100644
--- a/xdocs/miscellaneous/changelog.xml
+++ b/xdocs/miscellaneous/changelog.xml
@@ -79,6 +79,11 @@
       Common: Fix Clang 15/16 compatability. Pull request <pr>6</pr> provided 
by
       Sam James. (markt)
     </fix>
+    <fix>
+      Apache: <bug>65901</bug>: Don't delegate the generatation of the response
+      body to httpd when the status code represents an error if the request 
used
+      the HEAD method. (markt)
+    </fix>
   </changelog>
 </section>
 <section name="Changes between 1.2.47 and 1.2.48">


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

Reply via email to