On Fri, Jun 01, 2001 at 11:32:07AM -0700, [EMAIL PROTECTED] wrote:
> On Fri, 1 Jun 2001, Graham Leggett wrote:
> > [EMAIL PROTECTED] wrote:
> > > > > void reset_filters(r)
> > > > > {
> > > > > ap_filter_t *f = r->output_filters;
> > > > > int has_core = 0, has_content = 0, has_http_header = 0;
> > > > > while (f) {
> > > > > ap_filter_t *f2 = f->next;
> > > > > ap_remove_filter(f);
> > > > > f = f2;
> > > > > }
> > > > > ap_add_output_filter("CORE", NULL, r, r->connection);
> > > > > ap_add_output_filter("CONTENT_LENGTH", NULL, r, r->connection);
> > > > > ap_add_output_filter("HTTP_HEADER", NULL, r, r->connection);
> > > > > }
>...
> > Ok - so to sum up basically reset_filters() should remove all filters
> > from the stack, then add the three minimal basic filters, and run with
> > it from there...?
>
> Yep. Just makes the code easier by removing a bunch of if's. It also
> makes it very obvious just what the required filters are. If we ever need
> to add another required filter, it just gets added right there.
Then simplify the code even more:
void reset_filters(request_rec *r)
{
r->output_filters = NULL;
ap_add_output_filter("CORE", NULL, r, r->connection);
ap_add_output_filter("CONTENT_LENGTH", NULL, r, r->connection);
ap_add_output_filter("HTTP_HEADER", NULL, r, r->connection);
}
I'm wondering what would happen if we had already sent data out. That would
be icky... but I guess we alrady have that problem today (and in 1.3).
Cheers,
-g
--
Greg Stein, http://www.lyra.org/