You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Thomas Hilbig <th...@yahoo.com> on 2005/05/21 06:39:59 UTC
Re: DirectoryIndex ignored when using perl-handler
I really apologize for resurrecting a thread that was
put to rest almost a month ago. I am just running
into this problem now, and I don't quite understand
what the fix is. I'm very new to writing a MP
handler.
I am trying to write a (yet another) authentication
handler for a directory that is to be indexed. By I
am finding that no matter what I try, based on the
April thread, I just can't get the normal directory
indexing to work.
I've stripped out all of the handler's real logic and
the usual MP1/MP2 detection below, and it just returns
a simple DECLINE. As with the original poster's
problem, unless I specify the filename in the URL it
fails with the error log "Attempt to Server Directory"
Using just the stub code below, I would like to know
how to get it to give the directory index. I've tried
adding ..
$r->handler(Apache::Const::DIR_MAGIC_TYPE);
return OK;
.. just to see if it gives a directory index, but only
an empty file is returned to the browser (but no
error). What am I doing wrong?
Tom
Linux, httpd 2.0.52
httpd.conf snippet:
<Location /tempsecure >
Options Indexes
SetHandler perl-script
PerlResponseHandler My::Dummy
</Location>
site_perl\My\Dummy.pm file:
package My::Dummy ;
use Apache::Const -compile => qw(DIR_MAGIC_TYPE OK
DECLINED);
use Apache::RequestRec;
use strict;
use warnings;
use CGI qw/header path_info redirect
path_translated/;
sub handler {
my $r = shift;
# fix to detect blank file and pass to directory
index goes here...
return DECLINED ;
}
1;
__END__
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: DirectoryIndex ignored when using perl-handler
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Thomas Hilbig wrote:
> I really apologize for resurrecting a thread that was
> put to rest almost a month ago. I am just running
> into this problem now, and I don't quite understand
> what the fix is. I'm very new to writing a MP
> handler.
since you're new to mod_perl it's probably not obvious from that thread what
the solution is.
http://marc.theaimsgroup.com/?l=apache-modperl&m=111445150218566&w=2
the code at the bottom of that link (My::Fixup) needs to be enabled from a
PerlFixupHandler so that mod_dir can serve the request. in other words, if
you put it in the PerlResponseHandler like you are it's too late for mod_dir
to take action and DTRT. so
PerlFixupHandler My::Fixup
PerlResponseHandler My::Dummy
...etc...
HTH
--Geoff