From: Eric Covener Date: Fri, 28 Aug 2015 13:13:14 +0000 (+0000) Subject: Avoid adding duplicate subequest filters, as they would not be stripped X-Git-Tag: 2.5.0-alpha~2907 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=240d6e09d1f9447ba967a0f8c87cae8823d32703;p=thirdparty%2Fapache%2Fhttpd.git Avoid adding duplicate subequest filters, as they would not be stripped properly during an ap_internal_fast_redirect. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1698334 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 0420ab900cd..af36d7e4cdb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_dir: Responses that go through "FallbackResource" might appear to + hang due to unterminated chunked encoding. PR58292. [Eric Covener] + *) mod_socache_memcache: Add the 'MemcacheConnTTL' directive to control how long to keep idle connections with the memcache server(s). Change default value from 600 usec (!) to 15 sec. PR 58091 diff --git a/modules/http/http_request.c b/modules/http/http_request.c index 70bf2937c08..0143a2e73fb 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -613,8 +613,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 { /* diff --git a/server/request.c b/server/request.c index fa84c1ab325..fc6443992b9 100644 --- a/server/request.c +++ b/server/request.c @@ -1964,6 +1964,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. @@ -1972,8 +1974,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