2008/6/26 Torsten Foertsch <[EMAIL PROTECTED]>:

> On Wed 25 Jun 2008, titetluc titetluc wrote:
> > PerlModule Test
> > <Location /test_index/index.html>
> >     Require valid-user
> >     AuthType basic
> >     AuthName test_index
> >     SetHandler perl-script
> >
> >     PerlAuthenHandler Apache2::AuthSSO::Test->set_user
> >
> >     PerlResponseHandler Apache2::AuthSSO::Test->display_user
> > </Location>
> >
>

******
> In addition, I added an empty index.html file in the htdocs/test_index
> directory


> >
> > The Perl Test module is
> >
> > package Test;
> > use warnings;
> > use strict;
> > use Carp;
> >
> > use Apache2::Const qw(:common);
> >
> > sub set_user {
> >     my ($self, $r) = @_;
> >     $r->user('myself');
> >     return OK;
> > }
> > sub display_user {
> >     my ($self, $r) = @_;
> >     my $user = defined $r->user ? $r->user : 'user is not defined';
> >     print $user;
> >     return OK;
> > }
> >
> > 1;
> >
> > When I access with my browser to http://localhost/test_index/index.html,
> > user is set to 'myself'
> > BUT when I access with my browser to http://localhost/test_index/ ...
> user
> > is not defined !!!
>
> What happens here? When you access .../index.html your main request matches
> the location condition and is served accordingly. If you access .../ the
> main
> request goes through all phases up to fixup missing the location directives
> because the condition does not match. In fixup mod_dir creates an URI
> subreq
> for each DirectoryIndex.
>
> mod_dir.c contains the following code:
>
>        /* The sub request lookup is very liberal, and the core
> map_to_storage
>         * handler will almost always result in HTTP_OK as /foo/index.html
>         * may be /foo with PATH_INFO="/index.html", or even / with
>         * PATH_INFO="/foo/index.html". To get around this we insist that
> the
>         * the index be a regular filetype.
>         *
>         * Another reason is that the core handler also makes the assumption
>         * that if r->finfo is still NULL by the time it gets called, the
>         * file does not exist.
>         */
>        if (rr->status == HTTP_OK
>            && (   (rr->handler && !strcmp(rr->handler, "proxy-server"))
>                || rr->finfo.filetype == APR_REG)) {
>            ap_internal_fast_redirect(rr, r);
>            return OK;
>        }
>
> You see, for the DirectoryIndex feature to work properly the index document
> has to have an associated file. Your index document is a
> PerlResponseHandler.
> So, I suspect there is no index.html file. In that case $r->filename
> is "/path/to/test_index" and $r->path_info "index.html" for the subreq.
>
> Use the source, Luke!
>
> Now, I think you can make it working in one of these ways:
>
> 1) create .../test_index/index.html as a regular file.
> 2) redirect /test_index/index.html to a file (Alias ....).
>

Torsten

I created the test_index/index.html as a regular file (see the stars above
;-)).
The effect is that my PerlResponseHandler is correctly called.

But my problem is that I can not retrieved the user (set in the
PerlAuthenHandler) in the PerlResponseHandler.

In PerlResponseHandler, $r->main and $r->prev are undefined. I can not
understand why $r->main AND $r->prev are not defined (intuitively, $r->prev
should be defined)




> Torsten
>
> --
> Need professional mod_perl support?
> Just hire me: [EMAIL PROTECTED]

Reply via email to