]> granicus.if.org Git - apache/commitdiff
Merge r1698334 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 21 Nov 2016 12:17:13 +0000 (12:17 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 21 Nov 2016 12:17:13 +0000 (12:17 +0000)
Avoid adding duplicate subequest filters, as they would not be stripped
properly during an ap_internal_fast_redirect.

Submitted by: covener
Reviewed/backported by: jim

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

CHANGES
STATUS
modules/http/http_request.c
server/request.c

diff --git a/CHANGES b/CHANGES
index 664038620a02d15061f90e58ff236fa508bc2088..4faf997abc433eea5747dfc39923b99f3a9948e9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.24
 
+  *) mod_dir: Responses that go through "FallbackResource" might appear to
+     hang due to unterminated chunked encoding. PR58292. [Eric Covener]
+
   *) mod_dav: Fix a potential cause of unbounded memory usage or incorrect
      behavior in a routine that sends <DAV:response>'s to the output filters.
      [Evgeny Kotkov]
diff --git a/STATUS b/STATUS
index f1a8d4b6b9c785114c72c7fd7bb1141eacd01112..83b38971bb1be195035fbea9d6be0e194636bfa5 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -117,12 +117,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) core: avoid adding multiple subrequest filters when there are nested 
-     subrequests.  PR58292
-     trunk patch:  http://svn.apache.org/r1698334
-     2.4.x patch:  trunk works modulo CHANGES
-     +1:  covener, jim, jchampion
-
   *) ssl: clear the error queue before SSL_read/write/accept(). PR60223
      trunk patch: http://svn.apache.org/r1769332
      2.4.x patch: https://home.apache.org/~jchampion/patches/2.4.x-ssl-error-queue.patch
index 9ce7b8b32987fadd5e7ffd24b349943b293340ab..3f5393e04ea94caae363dd3be82dc7a8a281ca6e 100644 (file)
@@ -711,8 +711,17 @@ AP_DECLARE(void) ap_internal_fast_redirect(request_rec *rr, request_rec *r)
     update_r_in_filters(r->output_filters, rr, r);
 
     if (r->main) {
-        ap_add_output_filter_handle(ap_subreq_core_filter_handle,
-                                    NULL, r, r->connection);
+        ap_filter_t *next = r->output_filters;
+        while (next && (next != r->proto_output_filters)) {
+            if (next->frec == ap_subreq_core_filter_handle) {
+                break;
+            }
+            next = next->next;
+        }
+        if (!next || next == r->proto_output_filters) {
+            ap_add_output_filter_handle(ap_subreq_core_filter_handle,
+                                        NULL, r, r->connection);
+        }
     }
     else {
         /*
index eecc0266b15a99b7e5fbd73f26a8e084e7e9aa6a..9377836e0f5864ef00827086b8fa12a207c65786 100644 (file)
@@ -1960,6 +1960,8 @@ static request_rec *make_sub_request(const request_rec *r,
 
     /* start with the same set of output filters */
     if (next_filter) {
+        ap_filter_t *scan = next_filter;
+
         /* while there are no input filters for a subrequest, we will
          * try to insert some, so if we don't have valid data, the code
          * will seg fault.
@@ -1968,8 +1970,16 @@ static request_rec *make_sub_request(const request_rec *r,
         rnew->proto_input_filters = r->proto_input_filters;
         rnew->output_filters = next_filter;
         rnew->proto_output_filters = r->proto_output_filters;
-        ap_add_output_filter_handle(ap_subreq_core_filter_handle,
-                                    NULL, rnew, rnew->connection);
+        while (scan && (scan != r->proto_output_filters)) {
+            if (scan->frec == ap_subreq_core_filter_handle) {
+                break;
+            }
+            scan = scan->next;
+        }
+        if (!scan || scan == r->proto_output_filters) {
+            ap_add_output_filter_handle(ap_subreq_core_filter_handle,
+                    NULL, rnew, rnew->connection);
+        }
     }
     else {
         /* If NULL - we are expecting to be internal_fast_redirect'ed