On Thu, 20 Feb 2003, Stas Bekman wrote: > 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 /
I do. But you're right, I'm not. > > 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_ Heh. I am going to make a new debugging installation to keep around permanently!!! - nick -- ~~~~~~~~~~~~~~~~~~~~ Nick Tonkin {|8^)>