httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Re: Allowing modules to add input filters is broken
Date Fri, 18 May 2001 14:40:32 GMT

Modules have no trouble at all inserting input filters that are used.  I
have modules that do so.  The thing is, there are two types of input
filters, ones that process headers and ones that process body data.  The
ones that process headers can process body data too.

In order for a module to insert a filter that works on headers, it must be
added for all requests, and thus it can be added in the pre_connection
phase.  This is because conditionally installing filters would logically
be based on some element of the request, but you don't know what the
request looks like until you have the headers read.  Chicken and egg.

Installing a filter that deals strictly with body data can be done during
the insert_filter phase.  This is where output filters are commonly
inserted into the chain.  Since this is always called before the handler
phase, we are alright.  This logically makes sense, because modules that
handle request body data do so by calling ap_get_client_block in the
handler phase.  So, as long as the input filter is inserted before the
handler is called everything is okay.

Exactly what are you trying to do, and how is it not working?


On Fri, 18 May 2001, Bill Stoddard wrote:

> To the best of my knowledge, there is no way for a module to add input
> filters -- in time for them to be used during input processing --.   Sure a
> module can call add_input_filter, but the ap_run_insert_filter hook is run
> too late for input filters to have any effect.
> There are several different ways to fix this....
> 1.  Call ap_run_insert_filter in time to be considered by the inbound
> processing.  (right after get_mime_headers() for instance). Using a single,
> non parameterized function to add input and output filters to the stack with
> the same call is trying to do too much with this one function. I cannot
> point to a speficic problem this will cause but I am sure they exist.
> 2. Pass an additional parameter on ap_run_insert_filter designating whether
> modules should insert their input filters or output filters. Call
> ap_run_insert_filter(INSERT_INPUT_FILTERS) right after the call to
> get_mime_headers(). Call ap_run_insert_filter(INSERT_OUTPUT_FILTERS) where
> it is called today out of process_request_internal(). Modules would all have
> to grok this parameter.
> 3. Another way to solve the this is to create a two new hooks to replace the
> insert_filter hook:  ap_run_insert_input_filter() &
> ap_run_insert_output_filter() and call each hook at the appropriate point in
> the cycle.
> 2 or 3 work for me. Leaning toward #3 right now.
> Ryan and Greg, opinions?
> Bill

Ryan Bloom               
406 29th St.
San Francisco, CA 94131

View raw message