Return-Path: Delivered-To: apmail-modperl-cvs-archive@apache.org Received: (qmail 15608 invoked by uid 500); 28 Sep 2001 15:17:16 -0000 Mailing-List: contact modperl-cvs-help@apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@perl.apache.org Delivered-To: mailing list modperl-cvs@apache.org Received: (qmail 15596 invoked by uid 500); 28 Sep 2001 15:17:16 -0000 Delivered-To: apmail-modperl-2.0-cvs@apache.org Date: 28 Sep 2001 15:16:06 -0000 Message-ID: <20010928151606.31873.qmail@icarus.apache.org> From: dougm@apache.org To: modperl-2.0-cvs@apache.org Subject: cvs commit: modperl-2.0/todo missing_old_features.txt X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dougm 01/09/28 08:16:06 Modified: lib/ModPerl Code.pm src/modules/perl mod_perl.c modperl_callback.c modperl_config.c modperl_env.c modperl_env.h modperl_options.c modperl_types.h todo missing_old_features.txt Log: fix SetupEnv such that: PerlOptions +SetupEnv happens as early as possible +SetEnv is the default only for perl-script handler Revision Changes Path 1.70 +10 -3 modperl-2.0/lib/ModPerl/Code.pm Index: Code.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- Code.pm 2001/09/27 19:04:38 1.69 +++ Code.pm 2001/09/28 15:16:06 1.70 @@ -96,13 +96,20 @@ Srv => ['NONE', @ithread_opts, qw(ENABLE AUTOLOAD MERGE_HANDLERS), @hook_flags, 'UNSET'], Dir => [qw(NONE PARSE_HEADERS SETUP_ENV MERGE_HANDLERS GLOBAL_REQUEST UNSET)], - Req => [qw(NONE SET_GLOBAL_REQUEST)], + Req => [qw(NONE SET_GLOBAL_REQUEST SETUP_ENV)], Interp => [qw(NONE IN_USE PUTBACK CLONED BASE)], Handler => [qw(NONE PARSED METHOD OBJECT ANON AUTOLOAD DYNAMIC)], ); +$flags{DirSeen} = $flags{Dir}; + my %flags_options = map { $_,1 } qw(Srv Dir); +my %flags_field = ( + DirSeen => 'flags->opts_seen', + (map { $_, 'flags->opts' } keys %flags_options), +); + sub new { my $class = shift; bless { @@ -334,9 +341,9 @@ } my $flags = join $class, qw(Mp FLAGS); + my $field = $flags_field{$class} || 'flags'; - print $h_fh "\n#define $flags(p) ", - ($flags_options{$class} ? '(p)->flags->opts' : '(p)->flags'), "\n"; + print $h_fh "\n#define $flags(p) (p)->$field\n"; $class = "Mp$class"; print $h_fh "\n#define ${class}Type $n\n"; 1.79 +5 -0 modperl-2.0/src/modules/perl/mod_perl.c Index: mod_perl.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- mod_perl.c 2001/09/27 23:29:51 1.78 +++ mod_perl.c 2001/09/28 15:16:06 1.79 @@ -511,6 +511,11 @@ } #endif + /* default is +SetupEnv, skip if PerlOption -SetupEnv */ + if (MpDirSETUP_ENV(dcfg) || !MpDirSeenSETUP_ENV(dcfg)) { + modperl_env_request_populate(aTHX_ r); + } + if (MpDirPARSE_HEADERS(dcfg)) { rcfg->wbucket.header_parse = 1; } 1.44 +5 -0 modperl-2.0/src/modules/perl/modperl_callback.c Index: modperl_callback.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- modperl_callback.c 2001/09/17 23:36:36 1.43 +++ modperl_callback.c 2001/09/28 15:16:06 1.44 @@ -138,6 +138,11 @@ case MP_HANDLER_TYPE_PER_SRV: 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_CONNECTION: modperl_handler_make_args(aTHX_ &av_args, 1.41 +0 -2 modperl-2.0/src/modules/perl/modperl_config.c Index: modperl_config.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- modperl_config.c 2001/09/27 23:31:36 1.40 +++ modperl_config.c 2001/09/28 15:16:06 1.41 @@ -9,8 +9,6 @@ dcfg->interp_scope = MP_INTERP_SCOPE_UNDEF; #endif - MpDirSETUP_ENV_On(dcfg); /* %ENV setup on by default */ - return dcfg; } 1.8 +16 -9 modperl-2.0/src/modules/perl/modperl_env.c Index: modperl_env.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_env.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- modperl_env.c 2001/09/27 23:31:36 1.7 +++ modperl_env.c 2001/09/28 15:16:06 1.8 @@ -36,19 +36,30 @@ { NULL } }; -static void modperl_env_request_populate(pTHX_ request_rec *r) +void modperl_env_request_populate(pTHX_ request_rec *r) { + MP_dRCFG; HV *hv = GvHV(PL_envgv); int i; U32 mg_flags; - apr_array_header_t *array = apr_table_elts(r->subprocess_env); - apr_table_entry_t *elts = (apr_table_entry_t *)array->elts; + apr_array_header_t *array; + apr_table_entry_t *elts; + + if (MpReqSETUP_ENV(rcfg)) { + return; + } + + MP_TRACE_g(MP_FUNC, "populating environment for %s\n", r->uri); + ap_add_common_vars(r); ap_add_cgi_vars(r); modperl_env_untie(mg_flags); + array = apr_table_elts(r->subprocess_env); + elts = (apr_table_entry_t *)array->elts; + for (i = 0; i < array->nelts; i++) { if (!elts[i].key || !elts[i].val) { continue; @@ -64,6 +75,8 @@ } modperl_env_tie(mg_flags); + + MpReqSETUP_ENV_On(rcfg); } static int modperl_env_request_set(pTHX_ SV *sv, MAGIC *mg) @@ -104,12 +117,6 @@ void modperl_env_request_tie(pTHX_ request_rec *r) { - MP_dDCFG; - - if (MpDirSETUP_ENV(dcfg)) { - modperl_env_request_populate(aTHX_ r); - } - EnvMgObj = (char *)r; PL_vtbl_envelem.svt_set = MEMBER_TO_FPTR(modperl_env_request_set); 1.4 +3 -0 modperl-2.0/src/modules/perl/modperl_env.h Index: modperl_env.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_env.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- modperl_env.h 2001/09/27 23:31:36 1.3 +++ modperl_env.h 2001/09/28 15:16:06 1.4 @@ -8,7 +8,10 @@ #define modperl_env_tie(mg_flags) \ SvFLAGS((SV*)GvHV(PL_envgv)) |= mg_flags +void modperl_env_request_populate(pTHX_ request_rec *r); + void modperl_env_request_tie(pTHX_ request_rec *r); + void modperl_env_request_untie(pTHX_ request_rec *r); #endif /* MODPERL_ENV_H */ 1.10 +4 -0 modperl-2.0/src/modules/perl/modperl_options.c Index: modperl_options.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_options.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- modperl_options.c 2001/09/27 23:31:36 1.9 +++ modperl_options.c 2001/09/28 15:16:06 1.10 @@ -82,6 +82,8 @@ } #endif + o->opts_seen |= opt; + if (action == '-') { o->opts_remove |= opt; o->opts_add &= ~opt; @@ -125,6 +127,8 @@ conf->opts_add = add->opts_add; conf->opts_remove = add->opts_remove; } + + conf->opts_seen |= add->opts_seen; return conf; } 1.50 +1 -0 modperl-2.0/src/modules/perl/modperl_types.h Index: modperl_types.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- modperl_types.h 2001/09/27 23:31:36 1.49 +++ modperl_types.h 2001/09/28 15:16:06 1.50 @@ -98,6 +98,7 @@ modperl_opts_t opts_add; modperl_opts_t opts_remove; modperl_opts_t opts_override; + modperl_opts_t opts_seen; int unset; } modperl_options_t; 1.8 +0 -4 modperl-2.0/todo/missing_old_features.txt Index: missing_old_features.txt =================================================================== RCS file: /home/cvs/modperl-2.0/todo/missing_old_features.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- missing_old_features.txt 2001/09/27 20:03:37 1.7 +++ missing_old_features.txt 2001/09/28 15:16:06 1.8 @@ -10,10 +10,6 @@ - PerlSetEnv, PerlPassEnv -- PerlSetupEnv (PerlOptions +SetupEnv) currently only happens within - the perl-script handler; needs to happen earlier. should only - default to On within the perl-script handler - - PerlModule, PerlRequire: missing support for .htaccess as 1.x does. - pod directives (=pod,=back,=cut) and __END__