Re: Inconsistency with dhandlers

David Wheeler <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On May 11, 2004, at 9:55 AM, Dave Rolsky wrote:

> This can be done in Apache 2.0, I think.  In 1.x, we'd probably need to
> write a mod_dir-alike in Perl.

That's what I'm thinking Should be pretty simple. Something like:

package Apache::Dir;
use Apache::Constants qw(DECLINED HTTP_MOVED_PERMANENTLY);

sub handler {
     return DECLINED unless -d $r->filepath && $r->uri !~ m{/$};
     my $args = $r->args;
     $r->header_out(Location => $r->uri . '/' . $args ? "?$args" : '');
     return HTTP_MOVED_PERMANENTLY;
}

Then we can stack the handlers;

   PerlHandler Apache::Dir HTML::Mason::ApacheHandler

At least I think so. I'll look at doing this when I return from 
vacation on Tuesday.

Regards,

David

PS: And to reply to something I wrote to Jon earlier, $r->uri does 
_not_ include the GET string! My mistake.



-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.