Nick Tonkin wrote:
Hi all,

I my httpd.conf I have:

    <Location />
        AddType text/html .html
        PerlAccessHandler   WM::Auth::Access
    </Location>

And in my handler I have:

package WM::Auth::Access;

use strict;
use warnings;

use Time::HiRes qw(gettimeofday);

sub handler {
    my $r = shift;
    my $s = $r->server;

    $s->warn( "[$$] beginning at " . gettimeofday . " with [" . $r->uri . "]" );

    if (! $r->is_initial_req) {
        $s->warn( "[$$] \$r->is_initial_req false; declining at " . gettimeofday );
        return Apache::DECLINED;
    } elsif ($r->lookup_uri($r->uri)->content_type =~ /image/) {
        $s->warn( "[$$] image requested; declining at " . gettimeofday );
        return Apache::DECLINED;
    }
[ ... ]

When I request /img/logo.gif, I get:

[warn] [1168] beginning at 1045540634.07781 with [/img/logo.gif]
[warn] [1168] beginning at 1045540634.07883 with [/img/logo.gif]
[warn] [1168] $r->is_initial_req false; declining at 1045540634.07908
[warn] [1168] image requested; declining at 1045540634.07941


So, my quesstions are:

1) Why two times through the handler?
2) Why does the second time through start before the first one apparently
gets to the conditional?
3) Why is a simple request like that not the is_initial_req
4) If the first time through it reurns DECLINED because it's "not an
initial req", how come it goes through again?
5) What the heck is going on here?
do you have mod_dir configured? but then you aren't requisting /

Run with the tracing enabled and you will be able to debug it easily:
http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlTrace_


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to