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