]> granicus.if.org Git - apache/commitdiff
Do not bypass output filters when redirecting subrequests internally.
authorAndre Malo <nd@apache.org>
Sat, 22 Mar 2003 22:15:40 +0000 (22:15 +0000)
committerAndre Malo <nd@apache.org>
Sat, 22 Mar 2003 22:15:40 +0000 (22:15 +0000)
PR: 17629

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99042 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http/http_request.c

diff --git a/CHANGES b/CHANGES
index db848cef4b9c1caba4528c415029991210f946f7..ad75a880e5a99e8c34ca6a8eaf2da1d81a6ad071 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Do not bypass output filters when redirecting subrequests internally.
+     PR 17629.  [AndrĂ© Malo]
+
   *) OpenSSL headers should be included as "openssl/ssl.h", and not rely on
      the INCLUDE path to be defined properly.
      PR 11310. [Geoff Thrope <geoff@geoffthorpe.net>]
index 0a21296db73340a971cd060322c1ba3246fb3b7b..0817bba7b6d7983937421d9e5d8409775d9e2762 100644 (file)
@@ -394,17 +394,27 @@ static request_rec *internal_internal_redirect(const char *new_uri,
     new->proto_output_filters  = r->proto_output_filters;
     new->proto_input_filters   = r->proto_input_filters;
 
-    new->output_filters  = new->proto_output_filters;
-    new->input_filters   = new->proto_input_filters;
-
     if (new->main) {
+        new->output_filters = r->output_filters;
+        new->input_filters = r->input_filters;
+
         /* Add back the subrequest filter, which we lost when
          * we set output_filters to include only the protocol
          * output filters from the original request.
+         *
+         * XXX: This shouldn't be neccessary any longer, because the filter
+         * is still in place -- isn't it?
          */
         ap_add_output_filter_handle(ap_subreq_core_filter_handle,
                                     NULL, new, new->connection);
     }
+    else {
+        /* In subrequests we _must_ point to the complete upper request's
+         * filter chain, so skip the filters _only_ within the main request.
+         */
+        new->output_filters  = new->proto_output_filters;
+        new->input_filters   = new->proto_input_filters;
+    }
     
     update_r_in_filters(new->input_filters, r, new);
     update_r_in_filters(new->output_filters, r, new);
@@ -455,10 +465,19 @@ AP_DECLARE(void) ap_internal_fast_redirect(request_rec *rr, request_rec *r)
     r->subprocess_env = apr_table_overlay(r->pool, rr->subprocess_env,
                                           r->subprocess_env);
 
-    r->output_filters = rr->output_filters;
-    r->input_filters = rr->input_filters;
+    /* copy the filters _only_ within the main request. In subrequests
+     * we _must_ point to the upper requests' filter chain, so do not
+     * touch 'em!
+     */
+    if (!r->main) {
+        r->output_filters = rr->output_filters;
+        r->input_filters = rr->input_filters;
+    }
 
     if (r->main) {
+        /* XXX: This shouldn't be neccessary any longer, because the filter
+         * is still in place -- isn't it?
+         */
         ap_add_output_filter_handle(ap_subreq_core_filter_handle,
                                     NULL, r, r->connection);
     }