]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge of r1854004 from trunk:
authorStefan Eissing <icing@apache.org>
Wed, 13 Mar 2019 10:09:08 +0000 (10:09 +0000)
committerStefan Eissing <icing@apache.org>
Wed, 13 Mar 2019 10:09:08 +0000 (10:09 +0000)
  *) http: Fix possible empty response with mod_ratelimit for HEAD requests.

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

CHANGES
STATUS
modules/http/http_filters.c

diff --git a/CHANGES b/CHANGES
index 6b5608021199e7f987e311694a94f2b207255a5d..3e8b82ce9a64266ea5909f768ae726e98f57b996 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,15 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.39
 
+  *) http: Fix possible empty response with mod_ratelimit for HEAD requests.
+     PR 63192. [Yann Ylavic]
+
   *) MPMs unix: bind the bucket number of each child to its slot number, for a
      more efficient per bucket maintenance. [Yann Ylavic]
 
+  *) mod_cache_socache: Avoid reallocations and be safe with outgoing data
+     lifetime. [Yann Ylavic]
+
   *) mod_auth_digest: Fix a race condition. Authentication with valid
      credentials could be refused in case of concurrent accesses from
      different users.  PR 63124.  [Simon Kappel <simon.kappel axis.com>]
diff --git a/STATUS b/STATUS
index 2d38468b99fc3acf22debc2835934498f3b30119..e1351654a7f1cca7c252da543ac3b461ed79fc9e 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -126,12 +126,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) http: Fix possible empty response with mod_ratelimit for HEAD requests.
-     trunk patch: https://svn.apache.org/r1854004
-     2.4.x patch: svn merge -c 1854004 ^/httpd/httpd/trunk .
-     +1: elukey, ylavic, icing
-     ylavic: nice catch Luca, forgot about this one..
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 9828cdfcfbdd98de91818368384169d44b2dda05..5fc44e542f2c07b8e75f8b4e392b2e95f3619db1 100644 (file)
@@ -1290,6 +1290,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
     request_rec *r = f->r;
     conn_rec *c = r->connection;
     const char *clheader;
+    int header_only = (r->header_only || AP_STATUS_IS_HEADER_ONLY(r->status));
     const char *protocol = NULL;
     apr_bucket *e;
     apr_bucket_brigade *b2;
@@ -1307,7 +1308,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
     }
     else if (ctx->headers_sent) {
         /* Eat body if response must not have one. */
-        if (r->header_only || AP_STATUS_IS_HEADER_ONLY(r->status)) {
+        if (header_only) {
             /* Still next filters may be waiting for EOS, so pass it (alone)
              * when encountered and be done with this filter.
              */
@@ -1522,14 +1523,21 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
 
     terminate_header(b2);
 
-    rv = ap_pass_brigade(f->next, b2);
-    if (rv != APR_SUCCESS) {
-        goto out;
+    if (header_only) {
+        e = APR_BRIGADE_LAST(b);
+        if (e != APR_BRIGADE_SENTINEL(b) && APR_BUCKET_IS_EOS(e)) {
+            APR_BUCKET_REMOVE(e);
+            APR_BRIGADE_INSERT_TAIL(b2, e);
+            ap_remove_output_filter(f);
+        }
+        apr_brigade_cleanup(b);
     }
+
+    rv = ap_pass_brigade(f->next, b2);
+    apr_brigade_cleanup(b2);
     ctx->headers_sent = 1;
 
-    if (r->header_only || AP_STATUS_IS_HEADER_ONLY(r->status)) {
-        apr_brigade_cleanup(b);
+    if (rv != APR_SUCCESS || header_only) {
         goto out;
     }