You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Stein <gs...@lyra.org> on 2000/07/08 23:34:53 UTC

filter insertion (was: BIG filtering patch.)

[ 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:
> rbb@covalent.net 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
example:

*) 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).

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: filter insertion

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Jul 08, 2000 at 08:15:41PM -0400, Rodent of Unusual Size wrote:
> Greg Stein wrote:
> > *) 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
> 
> Bzzt.  CGI scripts must not be required to use magic
> server-specific types.  For one thing, that breaks the
> ability of the user to indicate whether the script's
> output should be filtered or not. -1.  The addition of
> filtering should not require any changes to existing
> scripts; black box.

Ken: that was an alternative to .conf-based specification. As I said, I have
no problem with explicit specification of what CGI output will go through.

I think the ap_set_content_type() is a Good Thing. Whether CGI uses it or
not: I'm not upset if you're -1 on it. I'm perfectly happy with AddFilter or
the like.

I am *totally* in your camp, re: requiring no changes to existing scripts.
Further, I don't think that we should require any *modules* to change to
take advantage of filtering.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: filter insertion (was: BIG filtering patch.)

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Greg Stein wrote:
> 
> *) 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

Bzzt.  CGI scripts must not be required to use magic
server-specific types.  For one thing, that breaks the
ability of the user to indicate whether the script's
output should be filtered or not. -1.  The addition of
filtering should not require any changes to existing
scripts; black box.
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

Removing my veto on filtering patch

Posted by Dirk-Willem van Gulik <di...@covalent.net>.
Having just ran through RBB's most recent submission's and Greg's ideas of
getting it better, and they seem to address all the concern's I had
tallied up in the last four days from my own wish lists and old comments
from Dean, Cliff, et.al. 

This kind of removed the strong urge I felt with coming up with an
alternative patch and my freezing veto because I felt that the patches two
week ago where soo seriously lacking.

Therefore I change my vote to:

	-0	on Greg's patch

And also give a 

	+1	on RBB's latest scheme

And most of all an apology for taking so long. Moving houses and shipping
it from Europe to the US took a lot more efford that I though. But this is
no excuse for bad planning on my side.

Dw