On Wed 23 Apr 2008, David E. Wheeler wrote:
> 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
> <VirtualHost *: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::DECLINE
> </VirtualHost>
>
> 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.
Well, I think I can shed some light on that mystery. When you use
the "perl-script" handler instead of "modperl" then your C-level response
handler is modperl_response_handler_cgi (see src/modules/perl/mod_perl.c).
This function calls modperl_env_request_populate (see modperl_env.c) and that
calls ap_add_cgi_vars (see httpd.../server/util_script.c). All that happens
in the response phase *before* the PerlResponseHandler is called.
ap_add_cgi_vars contains the following code:
if (r->path_info && r->path_info[0]) {
...
pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r,
NULL);
if (pa_req->filename) {
...
apr_table_setn(e, "PATH_TRANSLATED", pt);
You see, if path_info is used the C-notion of $r->lookup_uri is used to map
this path_info to the file system. The result is then made available as
$r->subprocess_env->{PATH_TRANSLATED}. This environment variable is seldom
used but unfortunately part of the CGI/1.1 standard
(http://hoohoo.ncsa.uiuc.edu/cgi/env.html).
Why the subreq is not set up if your transhandler is not used I can only
guess. Maybe it sets $r->path_info explicitly maybe it sets $r->filename so
that the standard maptostorage handler sets path_info. But path_info is
probably empty if your transhandler is not used.
Further I recall a problem/bug that if the PerlCleanupHandler is the only
configured Perl handler for a request it is not called. But that does not
seem to hit you since you have a (Trans|Access)Handler at least. If you think
that may be the case try the threading mod_perl branch. There the problem is
solved (http://svn.apache.org/repos/asf/perl/modperl/branches/threading).
That branch still does not work with perl 5.10.
Torsten
--
Need professional mod_perl support?
Just hire me: [EMAIL PROTECTED]