On Apr 23, 2008, at 11:53, David E. Wheeler wrote:

>> I was fiddling with that yesterday, and $r->main seemed to return
>> true every time. But I'll try again.

>
> The /101/ request *is* a subrequest? WTF is that coming from? It
> seems to happen after the AccessHandler finishes, but before the
> ResponseHandler runs. Maybe AccessHandler somehow triggers it? I
> don't see anything in there that looks like it calls path_info(),
> but I'll keep looking


The creation of the subrequest is weird. There code in Bricolage that
uses path_info() (it runs on Mason after all), but I can't see why the
subrequest gets created *only* if there is a TransHandler, even if
that TransHandler does nothing but return DECLINED.

To whit, I changed the TransHandler to just use
Apache2::Const:ECLINED for its handler. Nothing else. The request
looks like this:

77532 AccessHandler start for (main) /workflow/profile/desk/101/101/
77532 AccessHandler finish for (main) /workflow/profile/desk/101/101/
77532 CleanupHandler start for (sub) /101/
77532 ResponseHandler start for (main) /workflow/profile/desk/101/101/
77532 ResponseHandler finish for (main) /workflow/profile/desk/101/101/
77532 CleanupHandler start for (main) /workflow/profile/desk/101/101/
77532 CleanupHandler finish for (main) /workflow/profile/desk/101/101/

If I remove the TransHandler altogether, it looks like this:

77709 AccessHandler start for (main) /workflow/profile/desk/101/101/
77709 AccessHandler finish for (main) /workflow/profile/desk/101/101/
77709 ResponseHandler start for (main) /workflow/profile/desk/101/101/
77709 ResponseHandler finish for (main) /workflow/profile/desk/101/101/
77709 CleanupHandler start for (main) /workflow/profile/desk/101/101/
77709 CleanupHandler finish for (main) /workflow/profile/desk/101/101/

No subrequest appears at all! So this leads me to conclude one of two
things. Either

1. Internally, mod_perl's TransHandler code triggers the subrequest.
Why it would, I have no idea, but if there is no TransHandler, that
code doesn't execute and there is no subrequest. Or:

2. There is some code executing somewhere in Bricolage between the
AccessHander and the ResponseHandler, but only if there is a
TransHandler. If this is the case, I have no idea where that code
would be. Remember, this is my httpd.conf:

NameVirtualHost *:80

DocumentRoot /usr/local/bricolage/comp
ServerName localhost
DefaultType "text/html; charset=utf-8"
AddDefaultCharset utf-8
SetHandler perl-script
PerlResponseHandler Bric::App::Handler
PerlAccessHandler Bric::App::AccessHandler
PerlCleanupHandler Bric::App::CleanupHandler
PerlTransHandler Apache2::Const:ECLINE


So, with this information, I can at least work around the problem by
declining to do anything in the AccessHandler or the CleanupHandler
when $r->main returns something, but I'm still mystfied as to where
this subrequest is coming from.

Thanks,

David