cvs commit: modperl-2.0/src/modules/perl modperl_env.c
dougm 2002/06/01 16:42:08 Modified:src/modules/perl modperl_env.c Log: pass the PATH and TZ environment variables at startup by default as 1.xx did Revision ChangesPath 1.25 +22 -0 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.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- modperl_env.c 30 May 2002 23:35:02 - 1.24 +++ modperl_env.c 1 Jun 2002 23:42:07 - 1.25 -85,10 +85,32 modperl_env_tie(mg_flags); } +/* list of environment variables to pass by default */ +static const char *MP_env_pass_defaults[] = { +PATH, TZ, NULL +}; + void modperl_env_configure_server(pTHX_ apr_pool_t *p, server_rec *s) { /* XXX: propagate scfg-SetEnv to environ */ MP_dSCFG(s); +int i = 0; + +for (i=0; MP_env_pass_defaults[i]; i++) { +const char *key = MP_env_pass_defaults[i]; +char *val; + +if (apr_table_get(scfg-SetEnv, key) || +apr_table_get(scfg-PassEnv, key)) +{ +continue; /* already configured */ +} + +if ((val = getenv(key))) { +apr_table_set(scfg-PassEnv, key, val); +} +} + modperl_env_table_populate(aTHX_ scfg-SetEnv); modperl_env_table_populate(aTHX_ scfg-PassEnv); }
cvs commit: modperl-2.0/src/modules/perl modperl_env.c
dougm 02/05/27 11:39:03 Modified:src/modules/perl modperl_env.c Log: propagate scfg-SetEnv to %ENV Revision ChangesPath 1.21 +26 -18modperl-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.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- modperl_env.c 19 Nov 2001 00:07:28 - 1.20 +++ modperl_env.c 27 May 2002 18:39:03 - 1.21 -62,9 +62,34 modperl_env_tie(mg_flags); } +static void modperl_env_table_populate(pTHX_ apr_table_t *table) +{ +HV *hv = ENVHV; +U32 mg_flags; +int i; +const apr_array_header_t *array; +apr_table_entry_t *elts; + +modperl_env_untie(mg_flags); + +array = apr_table_elts(table); +elts = (apr_table_entry_t *)array-elts; + +for (i = 0; i array-nelts; i++) { + if (!elts[i].key || !elts[i].val) { +continue; +} +modperl_env_hv_store(aTHX_ hv, elts[i]); +} + +modperl_env_tie(mg_flags); +} + void modperl_env_configure_server(pTHX_ apr_pool_t *p, server_rec *s) { /* XXX: propagate scfg-SetEnv to environ */ +MP_dSCFG(s); +modperl_env_table_populate(aTHX_ scfg-SetEnv); } #define overlay_subprocess_env(r, tab) \ -106,11 +131,6 void modperl_env_request_populate(pTHX_ request_rec *r) { MP_dRCFG; -HV *hv = ENVHV; -U32 mg_flags; -int i; -const apr_array_header_t *array; -apr_table_entry_t *elts; if (MpReqSETUP_ENV(rcfg)) { return; -124,19 +144,7 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; -} -modperl_env_hv_store(aTHX_ hv, elts[i]); -} - -modperl_env_tie(mg_flags); +modperl_env_table_populate(aTHX_ r-subprocess_env); #ifdef MP_COMPAT_1X modperl_env_default_populate(aTHX); /* reset GATEWAY_INTERFACE */
cvs commit: modperl-2.0/src/modules/perl modperl_env.c
dougm 02/05/27 17:35:00 Modified:src/modules/perl modperl_env.c Log: untabify Revision ChangesPath 1.23 +1 -1 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.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- modperl_env.c 27 May 2002 20:19:40 - 1.22 +++ modperl_env.c 28 May 2002 00:35:00 - 1.23 -76,7 +76,7 elts = (apr_table_entry_t *)array-elts; for (i = 0; i array-nelts; i++) { - if (!elts[i].key || !elts[i].val) { +if (!elts[i].key || !elts[i].val) { continue; } modperl_env_hv_store(aTHX_ hv, elts[i]);
cvs commit: modperl-2.0/src/modules/perl modperl_env.c
dougm 01/10/13 12:12:17 Modified:src/modules/perl modperl_env.c Log: s/modperl_env_const_vars/MP_env_const_vars/g Revision ChangesPath 1.14 +4 -4 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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- modperl_env.c 2001/10/13 19:11:32 1.13 +++ modperl_env.c 2001/10/13 19:12:17 1.14 @@ -31,7 +31,7 @@ #define MP_ENV_ENT(k,v) \ { k, sizeof(k)-1, v, sizeof(v)-1, 0 } -static modperl_env_ent_t modperl_env_const_vars[] = { +static modperl_env_ent_t MP_env_const_vars[] = { #ifdef MP_COMPAT_1X MP_ENV_ENT(GATEWAY_INTERFACE, CGI-Perl/1.1), #endif @@ -41,7 +41,7 @@ void modperl_env_hash_keys(void) { -modperl_env_ent_t *ent = modperl_env_const_vars; +modperl_env_ent_t *ent = MP_env_const_vars; while (ent-key) { PERL_HASH(ent-hash, ent-key, ent-klen); @@ -69,8 +69,8 @@ modperl_env_untie(mg_flags); -for (i = 0; modperl_env_const_vars[i].key; i++) { -const modperl_env_ent_t *ent = modperl_env_const_vars[i]; +for (i = 0; MP_env_const_vars[i].key; i++) { +const modperl_env_ent_t *ent = MP_env_const_vars[i]; hv_store(hv, ent-key, ent-klen, newSVpvn(ent-val, ent-vlen), ent-hash);
cvs commit: modperl-2.0/src/modules/perl modperl_env.c
dougm 01/10/13 12:14:58 Modified:src/modules/perl modperl_env.c Log: use consistent style to iterate over MP_env_const_vars Revision ChangesPath 1.15 +3 -4 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.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- modperl_env.c 2001/10/13 19:12:17 1.14 +++ modperl_env.c 2001/10/13 19:14:58 1.15 @@ -63,17 +63,16 @@ void modperl_env_default_populate(pTHX) { +modperl_env_ent_t *ent = MP_env_const_vars; HV *hv = ENVHV; U32 mg_flags; -int i; modperl_env_untie(mg_flags); -for (i = 0; MP_env_const_vars[i].key; i++) { -const modperl_env_ent_t *ent = MP_env_const_vars[i]; - +while (ent-key) { hv_store(hv, ent-key, ent-klen, newSVpvn(ent-val, ent-vlen), ent-hash); +ent++; } modperl_env_tie(mg_flags);
cvs commit: modperl-2.0/src/modules/perl modperl_env.c modperl_env.h
dougm 01/09/28 09:39:15 Modified:src/modules/perl modperl_env.c modperl_env.h Log: cut down on some noise with new ENVHV macro Revision ChangesPath 1.9 +4 -4 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- modperl_env.c 2001/09/28 15:16:06 1.8 +++ modperl_env.c 2001/09/28 16:39:15 1.9 @@ -1,6 +1,6 @@ #include mod_perl.h -#define EnvMgObj SvMAGIC((SV*)GvHV(PL_envgv))-mg_ptr +#define EnvMgObj SvMAGIC((SV*)ENVHV)-mg_ptr static MP_INLINE void modperl_env_hv_store(pTHX_ HV *hv, apr_table_entry_t *elt) @@ -39,7 +39,7 @@ void modperl_env_request_populate(pTHX_ request_rec *r) { MP_dRCFG; -HV *hv = GvHV(PL_envgv); +HV *hv = ENVHV; int i; U32 mg_flags; apr_array_header_t *array; @@ -121,7 +121,7 @@ PL_vtbl_envelem.svt_set = MEMBER_TO_FPTR(modperl_env_request_set); #ifdef MP_PERL_HV_GMAGICAL_AWARE -SvGMAGICAL_on((SV*)GvHV(PL_envgv)); +SvGMAGICAL_on((SV*)ENVHV); PL_vtbl_envelem.svt_get = MEMBER_TO_FPTR(modperl_env_request_get); #endif } @@ -130,7 +130,7 @@ { PL_vtbl_envelem.svt_set = MEMBER_TO_FPTR(Perl_magic_setenv); #ifdef MP_PERL_HV_GMAGICAL_AWARE -SvGMAGICAL_off((SV*)GvHV(PL_envgv)); +SvGMAGICAL_off((SV*)ENVHV); PL_vtbl_envelem.svt_get = 0; #endif } 1.5 +7 -3 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- modperl_env.h 2001/09/28 15:16:06 1.4 +++ modperl_env.h 2001/09/28 16:39:15 1.5 @@ -1,12 +1,16 @@ #ifndef MODPERL_ENV_H #define MODPERL_ENV_H +#ifndef ENVHV +# define ENVHV GvHV(PL_envgv) +#endif + #define modperl_env_untie(mg_flags) \ -mg_flags = SvMAGICAL((SV*)GvHV(PL_envgv)); \ -SvMAGICAL_off((SV*)GvHV(PL_envgv)) +mg_flags = SvMAGICAL((SV*)ENVHV); \ +SvMAGICAL_off((SV*)ENVHV) #define modperl_env_tie(mg_flags) \ -SvFLAGS((SV*)GvHV(PL_envgv)) |= mg_flags +SvFLAGS((SV*)ENVHV) |= mg_flags void modperl_env_request_populate(pTHX_ request_rec *r);