here's my solution to handler loop prevention when the initial
request to a handler isn't necessarily the main request:
sub handler {
my $r = shift;
my $mr = $r-main || $r;
if ($mr-notes-get(__PACKAGE__ . '::SEEN')) {
$r-log-debug(We are looping.);
return
instead of looping around try $r-main-notes or $r-prev-notes
hm, that loop should eventually hit all requests in the chain though, no?
also, the first hit to that handler could in fact be a subrequest,
so $r-main-notes may never be set.
i do admit i'm cargo culting a little bit by looping over
what technique would you use if you had to have a handler work
exactly once, even though it may never be invoked as an initial
request?
if you're in prefork, off the top of my head I might set a perl global and
then reset it using a cleanup handler. something like
$My::Foo::seen++;
On Thu, Jan 20, 2005 at 02:32:59PM -0800, Philippe M. Chiasson wrote:
Dorian Taylor wrote:
suppose i wanted the same logic as:
return Apache::DECLINED unless $r-is_initial_req;
except that sometimes it may be necessary to serve for a subrequest,
just not more than once. the construct
what about unregistering the handler from the stack? is that possible?
yes, but only if the phase you want to unregister isn't the same as the
current phase
# works, except during a PerlAuthenHandler
$r-set_handlers(PerlAuthenHandler = []);
just to clarify: what *are* $r-next/prev if not a