dhandler analysis
John Williams <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a report on what I found to be the current state of dhandlers.
Here's the setup:
/path/to/dhandler is a dhandler component
/path/to/file is a regular file
/path/to/dir is a (empty) directory
The interaction between apache and ApacheHandler.pm is like this:
When the last existing element of a url is a file,
/path/to/file/extra/stuff, apache sets
$r->filename = /path/to/file
$r->path_info = /extra/stuff
mason finds the file, and executes it.
When the last existing element of a url is a directory,
/path/to/dir/extra/stuff, apache sets
$r->filename = /path/to/dir/extra
$r->path_info = /stuff
mason finds that $r->filename is not a file, and goes on a dhandler hunt.
When it finds /path/to/dhandler, it sets
$m->dhandler_arg = dir/extra/stuff
<aside>
t/mason_handler_mod_perl.pl does some weird stuff with a /ah=0/ prefix and
altering $r->filename. It never sets /path/to/file as $r->filename,
because when apache is looking, it never finds /ah=0/path/to/file, so
things will always be dhandled by /path/to/dhandler, even though a file
exists. In my opinion, if a user plays tricks like that, they deserve
what they get.
</aside>
CGIHandler.pm, on the other hand, gets all of its path from
$ENV{PATH_INFO}. If .../extra/stuff does not exist, it goes on the
dhandler hunt, even for the path /path/to/file/extra/stuff. This is
inconsistent with ApacheHandler.pm, which would call /path/to/file instead
of hunting for a dhandler.
Apache2 has some extra annoyances. Where previously a "SetHandler"
directive would handle both /path/to/file/extra/stuff and
/path/to/dir/extra/stuff, now /path/to/dir/extra/stuff returns a 404 even
with "AcceptPathInfo on". My post to mod_perl_users yielded a workaround,
but not much sympathy that this behavior is wrong.
I have added some live tests for those part of this which are consistent.
Perhaps for 1.3 we should fix CGIHandler to do dhandlers the same way that
ApacheHandler does. I'm assuming this is the correct behavior, since it
got documented in the Mason book.
~ John Williams
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl