Re: filters and handlers?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joshua Slive wrote:
> On 8/19/07, Per Jessen <per@xxxxxxxxxxxx> wrote:
>> I've been re-reading the manual to try to gain a better understanding of
>> filters and handlers, specifically the difference between the two.
>>
>> The reason being -
>>
>> by default, the PHP interpreter is called as a handler (a typical
>> config: "AddHandler application/x-httpd-php .phtml".  By implementation
>> INCLUDES is a filter which is enabled using e.g.
>> "AddOutputFilter INCLUDES shtml".
>>
>> I'd like to have my files processed first by the INCLUDES filter, then
>> by the PHP handler.  The "AddOutputFilter" option clearly supports this
>> type of sequence.
>>
>> But back to my initial question - what is the functional difference
>> between a handler and a filter?
> 
> Handlers must originate the content themselves, whereas filters can
> deal with content passed down from someplace else.
> 
> PHP is only a handler, due to zend's requirement that it deal with the
> php file on disk and not in memory. (This was the argument at the
> time, anyway. I'm not sure if things in php land have evolved since
> that decision was made.) Therefore PHP must originate the content and
> can't act on content passed from someplace else like mod_include.

Substantially.  Thanks to John and I, and improvements in the Zend2
engine, it's quite a respectable filter now.

People are simply used to treating php as a handler.

That said; there can be only 1:1 handler for a request.  You can stack
many filters on top of that.

It's trivial to make a handler that is essentially printf("hello world!");

It's another thing to make a filter that decorates whatever comes up from
the core handler (e.g. "hello world!") and decorate it by processing it
in a scripting language or transforming it (e.g. into "<p>hello world!</p>"
or "HELLO WORLD!").

In a perfect world, there will be only a handful of handlers soon, such
as a filesystem handler, a database content record handler, etc.  Almost
everything else add-in modules do can be described as filtering, and once
they are a proper filter, things are much more pluggable.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux