> 
> I moved the session cleanup phase to a PerlLogHandler and it seems to be 
> working, except for one small issue. Request URIs for directories (i.e. no 
> filename specified) don't seem to trigger the log handler. I put some 
> warnings in the code to trace its execution. The following is a dump of my 
> logs following a test run:
> 
> [Thu Feb 21 15:02:46 2002] [warn] SessionPrepare called for GET 
> /iddb/target/index.pl
> [Thu Feb 21 15:02:46 2002] [warn] SessionPrepare called for GET 


[snip]


> 
> The first two lines are the browser's initial request for /iddb/target and 
> the subsequent redirect by Apache to /iddb/target/ and ultimately translated 
> to /iddb/target/index.pl. Notice that the fixup handler fires for both, but 
> the log handler doesn't. In lines seven and eight, I re-issued the initial 
> request and received the same result -- no log handler. However, in lines 11 
> and 12, I manually entered /iddb/target/index.pl into the browser's address 
> line. This time the log handler was called.
> 
> Bug or feature?


ok, I'd have to analyze this further, but here's what pops in my head...

mod_dir is calling ap_internal_redirect for the /iddb/target -> /iddb/target/ 
transition.  the way the request cycle seems to work is that the post-read 
request handler phase through the content-generation phase are handled by 
ap_process_request_internal (which is called by ap_internal_redirect), while the 
logging phase is actually handled by ap_process_request, which only happens for 
client initiated requests...

so, my theory is that the bulk of the request will run for requests handled by 
internal redirects _except_ for the logging phase, which only happens for the 
main request.  this can be easily verified by creating a PerlHandler that only 
calls $r->internal_redirect and returns OK, and seeing whether the Fixup phase 
runs twice and the Log phase once.

now that I think about it, this _may_ be buried somewhere in some documentation 
(it sounds vaguely familiar)... or I could be totally off the wall.  they are 
both equal at this point I think.

anyway, if my theory is correct, though, you may be able to solve your problem 
by doing

return DECLINED unless $r->is_initial_req;

in your fixup handler, which would keep it from running twice.

this is only untested theory at this point, and I'm rather tired.  I'll 
investigate more in the morning if things don't work out for you...

HTH

--Geoff


Reply via email to