On Wed 23 Apr 2008, David E. Wheeler wrote:
> No subrequest appears at all! So this leads me to conclude one of two =A0
> things. Either
>
> 1. Internally, mod_perl's TransHandler code triggers the subrequest. =A0
> Why it would, I have no idea, but if there is no TransHandler, that =A0
> code doesn't execute and there is no subrequest. Or:
>
> 2. There is some code executing somewhere in Bricolage between the =A0
> AccessHander and the ResponseHandler, but only if there is a =A0
> TransHandler. If this is the case, I have no idea where that code =A0
> would be. Remember, this is my httpd.conf:
>
> NameVirtualHost *:80
>
> =A0 DocumentRoot =A0 =A0 =A0 =A0 =A0 /usr/local/bricolage/comp
> =A0 ServerName =A0 =A0 =A0 =A0 =A0 =A0 localhost
> =A0 DefaultType =A0 =A0 =A0 =A0 =A0 =A0"text/html; charset=3Dutf-8"
> =A0 AddDefaultCharset =A0 =A0 =A0utf-8
> =A0 SetHandler =A0 =A0 =A0 =A0 =A0 =A0 perl-script
> =A0 PerlResponseHandler =A0 =A0Bric::App::Handler
> =A0 PerlAccessHandler =A0 =A0 =A0Bric::App::AccessHandler
> =A0 PerlCleanupHandler =A0 =A0 Bric::App::CleanupHandler
> =A0 PerlTransHandler =A0 =A0 =A0 Apache2::Const:ECLINE
>

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


Well, I think I can shed some light on that mystery. When you use=20
the "perl-script" handler instead of "modperl" then your C-level response=20
handler is modperl_response_handler_cgi (see src/modules/perl/mod_perl.c).=
=20
This function calls modperl_env_request_populate (see modperl_env.c) and th=
at=20
calls ap_add_cgi_vars (see httpd.../server/util_script.c). All that happens=
=20
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 =3D 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=
=20
this path_info to the file system. The result is then made available as=20
$r->subprocess_env->{PATH_TRANSLATED}. This environment variable is seldom=
=20
used but unfortunately part of the CGI/1.1 standard=20
(http://hoohoo.ncsa.uiuc.edu/cgi/env.html).

Why the subreq is not set up if your transhandler is not used I can only=20
guess. Maybe it sets $r->path_info explicitly maybe it sets $r->filename so=
=20
that the standard maptostorage handler sets path_info. But path_info is=20
probably empty if your transhandler is not used.

=46urther I recall a problem/bug that if the PerlCleanupHandler is the only=
=20
configured Perl handler for a request it is not called. But that does not=20
seem to hit you since you have a (Trans|Access)Handler at least. If you thi=
nk=20
that may be the case try the threading mod_perl branch. There the problem i=
s=20
solved (http://svn.apache.org/repos/asf/perl...threading).=20
That branch still does not work with perl 5.10.

Torsten

=2D-
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net