subrequests do not run all phase handlers?

subrequests do not run all phase handlers?

am 02.08.2008 20:38:20 von Stephen Howard

I'm issuing a lookup_uri request to launch a subrequest. I'm getting a
404 on the subrequest when I get a 200 OK response when visiting the
same uri from a browser. My suspicion is that this uri, which uses a
PerlInitHandler to transform the incoming url, can't be found under the
subrequest because the Init handler is not being run during the subrequest.

How many of the Apache request phases are run under a subrequest, and if
not all, then is there a way to indicate that I want some or all of them
to run?

thanks,
- Stephen

Re: subrequests do not run all phase handlers?

am 03.08.2008 11:47:17 von torsten.foertsch

On Sat 02 Aug 2008, Stephen Howard wrote:
> I'm issuing a lookup_uri request to launch a subrequest. =A0I'm getting
> a 404 on the subrequest when I get a 200 OK response when visiting
> the same uri from a browser. =A0My suspicion is that this uri, which
> uses a PerlInitHandler to transform the incoming url, can't be found
> under the subrequest because the Init handler is not being run during
> the subrequest.

An URI subreq starts with the URI Translation Phase (PerlTransHandler).=20
A PerlInitHandler is always skipped for subreqs since it is either a=20
PerlPostReadRequestHandler which comes before the PerlTransHandler or a=20
PerlHeaderParserHandler which is explicitly skipped for subreqs, see=20
httpd-2.x.y/server/request.c:ap_process_request_internal():

/* Only on the main request! */
if (r->main == NULL) {
if ((access_status =3D ap_run_header_parser(r))) {
return access_status;
}
}

A file subreq starts with the PerlMapToStorageHandler and skips the=20
PerlHeaderParserHandler as shown.

> How many of the Apache request phases are run under a subrequest, and
> if not all, then is there a way to indicate that I want some or all
> of them to run?

Subreqs and internal redirects can skip Access, Authen and Authz. The=20
initial req runs at least Access but can skip Authen and Authz=20
depending on Satisfy and whether authentication is required or not.

So the only phases that are really run by all requests are MapToStorage,=20
TypeChecker and Fixup.

The correct phase to transform the URI is a PerlTransHandler. It is run=20
for the initial req as well as for URI subreqs but is skipped for file=20
subreqs that don't have an URI by definition.

Yes, you can change that behavior by patching Apache.

Torsten

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

Re: subrequests do not run all phase handlers?

am 03.08.2008 20:04:24 von Stephen Howard

Just the answer I was looking for. Thanks, Torsten

- Stephen

Torsten Foertsch wrote:
> On Sat 02 Aug 2008, Stephen Howard wrote:
>
>> I'm issuing a lookup_uri request to launch a subrequest. I'm getting
>> a 404 on the subrequest when I get a 200 OK response when visiting
>> the same uri from a browser. My suspicion is that this uri, which
>> uses a PerlInitHandler to transform the incoming url, can't be found
>> under the subrequest because the Init handler is not being run during
>> the subrequest.
>>
>
> An URI subreq starts with the URI Translation Phase (PerlTransHandler).
> A PerlInitHandler is always skipped for subreqs since it is either a
> PerlPostReadRequestHandler which comes before the PerlTransHandler or a
> PerlHeaderParserHandler which is explicitly skipped for subreqs, see
> httpd-2.x.y/server/request.c:ap_process_request_internal():
>
> /* Only on the main request! */
> if (r->main == NULL) {
> if ((access_status = ap_run_header_parser(r))) {
> return access_status;
> }
> }
>
> A file subreq starts with the PerlMapToStorageHandler and skips the
> PerlHeaderParserHandler as shown.
>
>
>> How many of the Apache request phases are run under a subrequest, and
>> if not all, then is there a way to indicate that I want some or all
>> of them to run?
>>
>
> Subreqs and internal redirects can skip Access, Authen and Authz. The
> initial req runs at least Access but can skip Authen and Authz
> depending on Satisfy and whether authentication is required or not.
>
> So the only phases that are really run by all requests are MapToStorage,
> TypeChecker and Fixup.
>
> The correct phase to transform the URI is a PerlTransHandler. It is run
> for the initial req as well as for URI subreqs but is skipped for file
> subreqs that don't have an URI by definition.
>
> Yes, you can change that behavior by patching Apache.
>
> Torsten
>
> --
> Need professional mod_perl support?
> Just hire me: torsten.foertsch@gmx.net
>