Stas Bekman wrote:
Anybody? This was first posted 6 months ago. I'm reposting with an updated patch.

The current modperl-2.0 cvs has two problems with setting %ENV:

1. If PerlOptions +SetupEnv is not set, it sets the env too late (only for the 'perl-script' response handlers). pre-response handlers don't get the environment. So things like cookie based auth don't work out of box (need mangling with $r->subprocess_env).

IIRC, this is the same as mp1 behavior. mp/apache 1 require a call to set_cgi_env_vars to do this, which both mod_perl and mod_cgi do. calling $r->subprocess_env early was the solution, which made standard variables available early. just going by memory at this point, though :)



2. If 'PerlOptions +SetupEnv' is set, the %ENV setting happens too early, without giving header_parser handlers to modify the headers.

header-parser was a misnomer in apache 1.3 - the headers are already parsed before the phase runs. has that changed in 2.0? I know you can get to everything early now, especially with input filters, but I thought the request phases stayed the same.


but what exactly is the complaint? you want to manipulate the Cookie header before it gets to %ENV via a header-parser handler? we could always register the PerlHeaderParserHandler hook as HOOK_REALLY_FIRST and then add SetupEnv as a separate HOOK_FIRST handler :)


So I've tried to ammend these two problems, by letting the request a chance to set %ENV as the very last header_parser callback

but what exactly is the complaint? you want to manipulate the Cookie header before it gets to %ENV via a header-parser handler? instead of HOOK_LAST, we could always register two hooks - the PerlHeaderParserHandler hook as HOOK_REALLY_FIRST and then add modperl_env_request_populate logic as a separate HOOK_FIRST handler :)



(may be better to move it as the first callback of the access stage).

I definitely wouldn't do that - let's keep our use of the phases (in core, at least ;) to their official meanings as much as possible


Though it introduces the following problem: 'SetHandler modperl' automatically gets the default 'PerlOptions +SetupEnv', because there is no way to check what kind of 'SetHandler' we have before the response stage and when we get it, it's too late, %ENV has been set already. So the solution is to explicitly turn it off with 'PerlOptions -SetupEnv' for modperl.

Handlers before the 'access' stage should explicitly call $r->subprocess_env, if they want %ENV before the correct time.

If you have better ideas, speak up.

it's late, but I'm not sure this is an issue. $r->subprocess_env is the old way, so I don't see a problem carrying it over for early access. I definitely would't stick anything into the access phase


as for using the header-parser before %ENV is setup, I don't think you could do it before, so I don't see it as a major issue. of course, if we can get it right it would be a nice bonus :)

--Geoff


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to