perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <torsten.foert...@gmx.net>
Subject Re: setHandler question
Date Sat, 15 Dec 2012 11:12:59 GMT
On 12/14/2012 02:52 PM, André Warnier wrote:
> Or am I totally off-track here ?

I think yes, you are confused by the similarity of "finfo" and
"OR_FILEINFO".

The finfo part of $r is simply a data structure that represents the
metadata of a file on the filesystem such as modification dates, access
rights, the size and whether it is a regular file, directory, socket or
something else.

A standard request for a static file in Apache works as follows. In the
MapToStorage phase the request URI is mapped to a file (or directory) on
the filesystem (by means of DocumentRoot, Alias and the like). Then also
in the MapToStorage phase Apache performs a stat(2) call on the resolved
file name. The result is stored in $r->finfo.

Then in the response phase the information stored in finfo is used to
set up the Content-Length header as well as the cache control headers
like Etag and Last-Modified.

OR_FILEINFO on the other hand is simply a flag that represents the
"FileInfo" flag in the "AllowOverride" directive:

  http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

Modperl's $r->add_config acts more or less like a .htaccess file. In
this context the "SetHandler" directive needs "AllowOverride FileInfo"
to be in effect. See

  http://httpd.apache.org/docs/2.2/mod/core.html#sethandler

Unlike a .htaccess file, $r->add_config expects the override bits as the
next parameter after the list of configuration directives.

So, to be able to set the handler by means of

  $r->add_config(['SetHandler ...'])

you have to pass along a set of override bits that includes OR_FILEINFO.
That means for example

  $r->add_config(['SetHandler ...'], OR_FILEINFO)

or even

  $r->add_config(['SetHandler ...'], ~0)

since ~0 is an integer with all bits set.

I can't remember why I hinted at $r->add_config instead of
$r->handler('newhandler') at the time of the first discussion. Perhaps
there was a reason (like the wrong request phase), perhaps I had a blackout.

I hope you understand now that "OR_FILEINFO" and "finfo" are completely
unrelated things. The only thing they have in common is a certain
similarity in their names.

Torsten

Mime
View raw message