httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject filter insertion (was: BIG filtering patch.)
Date Sat, 08 Jul 2000 21:34:53 GMT
[ for those who don't like the changing subject line... well, consider that
  this note isn't about Ryan's patch, but about how filters get inserted.
  IMO, that means the subject should be changed(!) ]

On Sat, Jul 08, 2000 at 09:43:35AM -0400, Rodent of Unusual Size wrote:
> wrote:
> > 
> > Okay, so how does this work?  When does a module get to insert
> > it's filter onto the stack?
> IMHO, it shouldn't.  Modules should *never* insert filters on
> their own; it should be completely under the control of the
> user.  I'd expect something like:
> FilterSet setname1 ssi-parse digestify
> AddFilter .cgi setname1
> or maybe
> AddFilter .cgi ssi-parse digestify
> meaning that the output from the content handler for .cgi
> would be run through the SSI parser, and the result of *that*
> would then be passed through the digestifier.
> Which means the core builds the stack.

I agree that this must be possible, in addition to self-inserting. (see the
others' responses about self-inserting)

In my patch, I enabled the above scenario by giving each filter a name. The
core module could handle the above directives and call ap_add_filter() with
each named filter.

Note that digestify probably wouldn't be listed, but the "AddFilter .cgi
ssi-parse" would be entirely reasonable.

This thread also led into inserting filters based on MIME type. I described
how that could work once before, and will quickly repeat it here using an

*) mod_include would define the magic MIME type "application/vnd.apache-ssi"
*) mod_include registers that MIME type as "input" to the filter named
   "ssi-parse". it also registers the output will be "text/html"
*) CGI scripts would use that MIME type for their output
*) mod_cgi sees the Content-Type header and calls ap_set_content_type() with
   the value
*) ap_set_content_type() looks in the registration table and sees that
   "application/vnd.apache-ssi" implies a filter. It calls ap_add_filter()
   with the named filter ("ssi-parse") and then uses "text/html" for the
   content-type that really gets set.

Ta-da! MIME filtering. It would also be possible to set up similar value ->
filter-name mappings on other elements, such as Content-Encoding or
Content-Language. Each of these are straight-forward extensions once you
have named filters (such as my patch provides).


Greg Stein,

View raw message