The attached patch is - IMHO - ready for commit, but I'd very like some 
review from a subrequest/redirect/filter guru ;-).

PR 17629 deals with the problem, that internally redirected subrequests are 
not compressed (the main request has deflate in place). In particular they 
are meet the original filterchain too late (r->proto_output_filters) and 
thus skip the output_filters that are already in place.

There are some testcases, that work for me after applying the patch.
(standard installation)
- the testcase described in the PR (include virtual of a cgi script which 
  sends a Location header to a local file)
  [internal_redirect]

- <!--#include virtual="/" --> (mod_dir and type-map)
  [internal_fast_redirect and internal_redirect]

- <!--#include virtual="/manual/" --> (mod_dir and multiviews)
  [internal_fast_redirect and internal_fast_redirect]

- <!--#include virtual="/manual/index.html" --> (multiviews only)
  [internal_fast_redirect]

As said, please review. If nobody objects, I'm going to commit this fun 
these days.

TIA, nd
-- 
my @japh = (sub{q~Just~},sub{q~Another~},sub{q~Perl~},sub{q~Hacker~});
my $japh = q[sub japh { }]; print join       #########################
 [ $japh =~ /{(.)}/] -> [0] => map $_ -> ()  #            Andr� Malo #
=> @japh;                                    # http://www.perlig.de/ #
Index: modules/http/http_request.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_request.c,v
retrieving revision 1.154
diff -u -r1.154 http_request.c
--- modules/http/http_request.c 24 Feb 2003 00:57:40 -0000      1.154
+++ modules/http/http_request.c 20 Mar 2003 13:28:27 -0000
@@ -394,17 +394,27 @@
     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 @@
     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);
     }

Reply via email to