1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

* modules/http/http_request.c (internal_internal_redirect): For a

subrequest, preserve any filters in the output filter chain which
  were not specific to the subrequest across the redirect (where
  f->r does not point to the subreq's request_rec).

PR: 17629




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@952828 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joe Orton
2010-06-08 21:17:48 +00:00
parent a71d310a23
commit e446077b99
2 changed files with 41 additions and 7 deletions

View File

@@ -28,6 +28,10 @@ Changes with Apache 2.3.6
processing is completed, avoiding orphaned callback pointers. processing is completed, avoiding orphaned callback pointers.
[Brett Gervasoni <brettg senseofsecurity.com>, Jeff Trawick] [Brett Gervasoni <brettg senseofsecurity.com>, Jeff Trawick]
*) core: Adjust the output filter chain correctly in an internal
redirect from a subrequest, preserving filters from the main
request as necessary. PR 17629. [Joe Orton]
*) mod_cache: Explicitly allow cache implementations to cache a 206 Partial *) mod_cache: Explicitly allow cache implementations to cache a 206 Partial
Response if they so choose to do so. Previously an attempt to cache a 206 Response if they so choose to do so. Previously an attempt to cache a 206
was arbitrarily allowed if the response contained an Expires or was arbitrarily allowed if the response contained an Expires or

View File

@@ -460,16 +460,46 @@ static request_rec *internal_internal_redirect(const char *new_uri,
new->proto_output_filters = r->proto_output_filters; new->proto_output_filters = r->proto_output_filters;
new->proto_input_filters = r->proto_input_filters; new->proto_input_filters = r->proto_input_filters;
new->output_filters = new->proto_output_filters;
new->input_filters = new->proto_input_filters; new->input_filters = new->proto_input_filters;
if (new->main) { if (new->main) {
/* Add back the subrequest filter, which we lost when ap_filter_t *f, *nextf;
* we set output_filters to include only the protocol
* output filters from the original request. /* If this is a subrequest, the filter chain may contain a
*/ * mixture of filters specific to the old request (r), and
ap_add_output_filter_handle(ap_subreq_core_filter_handle, * some inherited from r->main. Here, inherit that filter
NULL, new, new->connection); * chain, and remove all those which are specific to the old
* request; ensuring the subreq filter is left in place. */
new->output_filters = r->output_filters;
f = new->output_filters;
do {
nextf = f->next;
if (f->r == r && f->frec != ap_subreq_core_filter_handle) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"dropping filter '%s' in internal redirect from %s to %s",
f->frec->name, r->unparsed_uri, new_uri);
/* To remove the filter, first set f->r to the *new*
* request_rec, so that ->output_filters on 'new' is
* changed (if necessary) when removing the filter. */
f->r = new;
ap_remove_output_filter(f);
}
f = nextf;
/* Stop at the protocol filters. If a protocol filter has
* been newly installed for this resource, better leave it
* in place, though it's probably a misconfiguration or
* filter bug to get into this state. */
} while (f && f != new->proto_output_filters);
}
else {
/* If this is not a subrequest, clear out all
* resource-specific filters. */
new->output_filters = new->proto_output_filters;
} }
update_r_in_filters(new->input_filters, r, new); update_r_in_filters(new->input_filters, r, new);