]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1773346 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 12 Dec 2016 15:21:29 +0000 (15:21 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 12 Dec 2016 15:21:29 +0000 (15:21 +0000)
Drop C-L header and message-body from HTTP 204 responses.

The C-L header can be set in a fcgi/cgi backend or in other
filters like ap_content_length_filter (with the value of 0),
meanwhile the message-body can be returned incorrectly
by any backend. The idea is to remove unnecessary bytes
from a HTTP 204 response.

PR 51350

Submitted by: elukey
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1773801 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/http/http_filters.c

diff --git a/CHANGES b/CHANGES
index 9f841a619145090839c30d170c04ba5b3db691bd..ab18d3b42097d18f7dd62ed8b3a7e171cfb8364e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -22,7 +22,10 @@ Changes with Apache 2.4.24
      MAC (SipHash) to prevent deciphering or tampering with a padding
      oracle attack.  [Yann Ylavic, Colm MacCarthaigh]
 
- *) mod_proxy: Honor a server scoped ProxyPass exception when ProxyPass is
+  *) core: Drop Content-Length header and message-body from HTTP 204 responses.
+     PR 51350 [Luca Toscano]
+
+  *) mod_proxy: Honor a server scoped ProxyPass exception when ProxyPass is
      configured in <Location>, like in 2.2. PR 60458.
      [Eric Covener]
 
diff --git a/STATUS b/STATUS
index 4fe0e94bfda05203008384b875f8c2177e73a52d..bfb116b135b57ac14e0aeacd5acc5c8dc8cd479b 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -136,11 +136,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
        https://svn.apache.org/r1773163
      +1: wrowe, jim, ylavic
 
-  *) core: Drop Content-Length header and message-body from HTTP 204 responses.
-     Trunk patch: http://svn.apache.org/r1773346
-     2.4.x patch: trunk works modulo CHANGES
-     +1: elukey, wrowe, ylavic
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 45c1d81198840c83f38214bbb502e72f51f311e3..9ce2a2a59942284b124eeacab431a9ae46ae55ad 100644 (file)
@@ -1262,7 +1262,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
 
     AP_DEBUG_ASSERT(!r->main);
 
-    if (r->header_only) {
+    if (r->header_only || r->status == HTTP_NO_CONTENT) {
         if (!ctx) {
             ctx = f->ctx = apr_pcalloc(r->pool, sizeof(header_filter_ctx));
         }
@@ -1353,6 +1353,10 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
         apr_table_unset(r->headers_out, "Content-Length");
     }
 
+    if (r->status == HTTP_NO_CONTENT) {
+        apr_table_unset(r->headers_out, "Content-Length");
+    }
+
     ctype = ap_make_content_type(r, r->content_type);
     if (ctype) {
         apr_table_setn(r->headers_out, "Content-Type", ctype);
@@ -1442,7 +1446,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
 
     ap_pass_brigade(f->next, b2);
 
-    if (r->header_only) {
+    if (r->header_only || r->status == HTTP_NO_CONTENT) {
         apr_brigade_cleanup(b);
         ctx->headers_sent = 1;
         return OK;