httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: cvs commit: apache-2.0/src/main util_filter.c
Date Thu, 17 Aug 2000 01:15:16 GMT
Ryan: this was vetoed pending discussion. (it was in my first email)

As I've said, this simply reverses the problem. Now the situation is that
the LIFO makes it easy to insert *some* types of filters and harder for
others. That is exactly where we were before.

You wanted an example: a PHP filter decides that it will generate SSI text
and wants to add an SSI filter. With the original add_filter, this will come

Another: let's say that we create ap_set_content_type() and let it add
filters based on content type. (Ken seems to not like this one because of
the need for magic MIME types, but let's go with it right now)  When
mod_mime calls ap_set_content_type() to set the PHP magic type, we grab that
and add a PHP processor. Next, we look in our config to see that all PHP
output should be run though SSI. So we add an SSI processor.

The "append" nature was designed to take this typical case into mind.

For the issue that you're seeing with chunking vs core, the filter type was
designed to deal with this problem. The ordering of the hooks is the basis
for simple ordering.

This LIFO thing? Now the add_filter is COMPLETELY BACKWARDS for the
insert_filter hook.

    ap_hook_insert_filter(my_hook, ..., AP_HOOK_MIDDLE);
    ap_hook_insert_filter(my_other_hook, ...., AP_HOOK_LAST);

Guess what? my_hook will run first, but the filter will go in *after* the
filter installed by my_other_hook.

Every filter writer would need to compensate with their insert_filter hook
to reverse the sense. This is just too much.

The chunking filter can be fixed by using the appropriate filter types. Not
by reversing the insertion.


On Thu, Aug 17, 2000 at 12:50:34AM -0000, wrote:
> rbb         00/08/16 17:50:34
>   Modified:    src/include util_filter.h
>                src/main util_filter.c
>   Log:
>   Make ap_add_filter use a LIFO stack instead of a FIFO queue to add filters
>   to the filter stack.  This makes the chunking filter work.  Without this,
>   the core_filter is installed in the insert_filters hook, when we get
>   to the ap_send_http_headers function, we insert the chunking filter, but
>   it has been installed after the core_filter.  This means the chunk_filter
>   is never called.
>   This reverses this.  The core_filter is installed in the insert_filters
>   hook, and we put the chunk_filter in during ap_send_http_headers.  This
>   time, the chunking filter is installed before the core_filter, and it
>   gets called correctly.

Greg Stein,

View raw message