|
|
Choosing A Webhost: |
Re: [patch] fixing the %ENV setting logic, breaking 'SetHandler modperl' a : msg#00196apache.mod-perl.devel
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: Index: src/modules/perl/mod_perl.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v retrieving revision 1.180 diff -u -r1.180 mod_perl.c --- src/modules/perl/mod_perl.c 22 Aug 2003 19:15:09 -0000 1.180 +++ src/modules/perl/mod_perl.c 23 Aug 2003 01:33:22 -0000 @@ -650,6 +650,33 @@ return OK; } +static int modperl_hook_header_parser_last(request_rec *r) +{ + + MP_dDCFG; + + /* XXX: modperl_env_request_populate() is called only once per + * request. It should be really called only after the + * header_parser phase is completed, to give a chance to other + * handlers to modify the headers. If handlers need to access %ENV + * before that, they should explicitly call $r->subprocess_env + */ + /* XXX: sections with 'SetHandler modperl', must set + * 'PerlOption -SetupEnv' to skip the env setting. + + /* 'default: PerlOption +SetupEnv */ + if (MpDirSETUP_ENV(dcfg) || !MpDirSeenSETUP_ENV(dcfg)) { +#ifdef USE_ITHREADS + modperl_interp_t *interp = + modperl_interp_select(r, r->connection, r->server); + dTHXa(interp->perl); +#endif + modperl_env_request_populate(aTHX_ r); + } + + return DECLINED; +} + static int modperl_destruct_level = 2; /* default is full tear down */ int modperl_perl_destruct_level(void) @@ -746,6 +773,9 @@ ap_hook_header_parser(modperl_hook_header_parser, NULL, NULL, APR_HOOK_FIRST); + ap_hook_header_parser(modperl_hook_header_parser_last, + NULL, NULL, APR_HOOK_LAST); + ap_hook_child_init(modperl_hook_child_init, NULL, NULL, APR_HOOK_FIRST); @@ -895,11 +925,6 @@ #endif modperl_perl_global_request_save(aTHX_ r); - - /* default is +SetupEnv, skip if PerlOption -SetupEnv */ - if (MpDirSETUP_ENV(dcfg) || !MpDirSeenSETUP_ENV(dcfg)) { - modperl_env_request_populate(aTHX_ r); - } /* default is +GlobalRequest, skip if PerlOption -GlobalRequest */ if (MpDirGLOBAL_REQUEST(dcfg) || !MpDirSeenGLOBAL_REQUEST(dcfg)) { Index: src/modules/perl/modperl_callback.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v retrieving revision 1.56 diff -u -r1.56 modperl_callback.c --- src/modules/perl/modperl_callback.c 19 Aug 2003 05:01:22 -0000 1.56 +++ src/modules/perl/modperl_callback.c 23 Aug 2003 01:33:22 -0000 @@ -149,10 +149,6 @@ modperl_handler_make_args(aTHX_ &av_args, "Apache::RequestRec", r, NULL); - /* only happens once per-request */ - if (MpDirSETUP_ENV(dcfg)) { - modperl_env_request_populate(aTHX_ r); - } break; case MP_HANDLER_TYPE_PRE_CONNECTION: case MP_HANDLER_TYPE_CONNECTION: Index: t/hooks/TestHooks/headerparser.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/headerparser.pm,v retrieving revision 1.2 diff -u -r1.2 headerparser.pm --- t/hooks/TestHooks/headerparser.pm 11 Apr 2002 11:08:43 -0000 1.2 +++ t/hooks/TestHooks/headerparser.pm 23 Aug 2003 01:33:22 -0000 @@ -13,6 +13,7 @@ sub handler { my $r = shift; + $r->subprocess_env; # %ENV is not set yet at this stage $r->notes->set(url => $ENV{REQUEST_URI}); Apache::OK; __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: MPM name, Stas Bekman |
|---|---|
| Next by Date: | cleaning up the logging interface, Stas Bekman |
| Previous by Thread: | Re: ModPerl2/Apache2 - Error handling return codes -RegistryCooker.pm:"Argument""isn't numeric ...& bottom of web page say:OK the server encounteredaninternal....., Adolph Torres |
| Next by Thread: | Re: [patch] fixing the %ENV setting logic, breaking 'SetHandler modperl' a bit, Geoffrey Young |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |