httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manoj Kasichainula <ma...@io.com>
Subject Re: [PATCH] ap_add_filter
Date Fri, 18 Aug 2000 18:59:52 GMT
On Fri, Aug 18, 2000 at 07:14:02AM -0700, rbb@covalent.net wrote:
> 
> > OK, a thought that fell out while writing up my design proposal for
> > 3.0.
> > 
> > I think think there will be scenarios where filters need to add
> > new filters both before and after themselves. To me, it seems kind of
> > scary to let every single filter operate directly on the "main"
> > filter chain as well.
> 
> Could you please give an example of such a filter?
> 
>  <snipped for brevity>
> > 
> > A -> B -> Q -> C -> D -> core
> > 
> > when Q decides it wants its buckets to run through a couple of extra
> > filters:
> > 
> > A -> B -> Q.interface    Q.impl           C -> D -> core
> >            V             ^     V         ^
> >        ___/              |     |         |
> >       /                  |     |         |
> >      1 -> 2 -> 3 -> 4 -> 5     6 -> 7 -> 8
> > 
> > 
> > With this setup, Q doesn't touch the main filter chain at all to add
> > its filters. Thoughts? It took way too many words to describe this,
> > but it doesn't feel like a complicated concept to me.
> 
> This feels very complicated to me.  It also looks very hard to
> implement in a way that is generic enough for any module to use.

Well, I did use the most complicated example with a middle filter
inserting filters both before and after itself, just to show that it's
possible. Here are the generic functions for this case though. Note;
I'm not 100% up on syntax here, and I *always* make a mistake every
time I reimplement linked lists. :)

constructor {
    me->filter_chain_head = me->filter_func_impl;
    me->filter_chain_tail = me->filter_func_impl;
}

me->filter_func() { // this is the filter->write() function, right?
    me->filter_chain_head();
}

insert_at_beginning_of_my_chain(filter) {
    filter->next = me->filter_chain_head;
    me->filter_chain_head = filter;
}

insert_at_end_of_my_chain(filter) {
    filter->next = me->next;
    me->filter_chain_tail->next = filter;
    me->filter_chain_tail = filter;
}

insert_after_me(filter) {
    filter->next = me->filter_func_impl;
    me->filter_func_impl->next = filter;
}

More complicated stuff, you use the BSD linked lists or Dean's. I
think that in most cases, most of this code isn't even necessary.

> I have no problem 
> letting modules munge the main filter stack themselves.

Well, if this can be avoided with very simple code, I'd just as soon
avoid it.

> This just really
> seems like overkill, and I can't see what it buys us.

Solves Greg-vs.-Ryan VII.


Mime
View raw message