View | Details | Raw Unified | Return to bug 17629
Collapse All | Expand All

(-)modules/http/http_request.c (-7 / +37 lines)
Lines 460-476 Link Here
460
    new->proto_output_filters  = r->proto_output_filters;
460
    new->proto_output_filters  = r->proto_output_filters;
461
    new->proto_input_filters   = r->proto_input_filters;
461
    new->proto_input_filters   = r->proto_input_filters;
462
462
463
    new->output_filters  = new->proto_output_filters;
464
    new->input_filters   = new->proto_input_filters;
463
    new->input_filters   = new->proto_input_filters;
465
464
466
    if (new->main) {
465
    if (new->main) {
467
        /* Add back the subrequest filter, which we lost when
466
        ap_filter_t *f, *nextf;
468
         * we set output_filters to include only the protocol
467
469
         * output filters from the original request.
468
        /* If this is a subrequest, the filter chain may contain a
470
         */
469
         * mixture of filters specific to the old request (r), and
471
        ap_add_output_filter_handle(ap_subreq_core_filter_handle,
470
         * some inherited from r->main.  Here, inherit that filter
472
                                    NULL, new, new->connection);
471
         * chain, and remove all those which are specific to the old
472
         * request; ensuring the subreq filter is left in place. */
473
        new->output_filters = r->output_filters;
474
475
        f = new->output_filters;
476
        do {
477
            nextf = f->next;
478
479
            if (f->r == r && f->frec != ap_subreq_core_filter_handle) {
480
                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
481
                              "dropping filter '%s' in internal redirect from %s to %s",
482
                              f->frec->name, r->unparsed_uri, new_uri);
483
484
                /* To remove the filter, first set f->r to the *new*
485
                 * request_rec, so that ->output_filters on 'new' is
486
                 * changed (if necessary) when removing the filter. */
487
                f->r = new;
488
                ap_remove_output_filter(f);
489
            }
490
491
            f = nextf;
492
493
            /* Stop at the protocol filters.  If a protocol filter has
494
             * been newly installed for this resource, better leave it
495
             * in place, though it's probably a misconfiguration or
496
             * filter bug to get into this state. */
497
        } while (f && f != new->proto_output_filters);
473
    }
498
    }
499
    else {
500
        /* If this is not a subrequest, clear out all
501
         * resource-specific filters. */
502
        new->output_filters  = new->proto_output_filters;
503
    }
474
504
475
    update_r_in_filters(new->input_filters, r, new);
505
    update_r_in_filters(new->input_filters, r, new);
476
    update_r_in_filters(new->output_filters, r, new);
506
    update_r_in_filters(new->output_filters, r, new);

Return to bug 17629