Configuration
Since we are proposing a new filter, we can and should take the opportunity
to rationalise all aspects of filter configuration.
The new mod_filter will implement
- FilterDeclare filter-name level
-
The handler for this will call ap_register_output_filter to register
filter_harness under the name supplied and at the level supplied.
- FilterDispatcher filter-name header-name match-criteria
-
This specifies an HTTP header and a pattern-matching criterion to
be used on its value to extract a key on which we dispatch.
- FilterProvider filter-name match-value handler
-
This specifies a match on the criterion supplied by FilterDispatcher,
and a filter handler (as provided by any Apache 2.0 filter module)
to be used as the dispatcher when the match is successful.
The existing directives (SetOutputFilter and family) can then be used
to insert or remove filters in the output chain as before.
Likewise, ap_add_output_filter can be used programmatically to
insert a smart filter, just as it can a traditional filter.
[ Question: do we want to abstract FilterDispatcher further to enable
RewriteRule/RewriteCond-like definition of dispatch criteria ? ]