You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@hyperreal.org on 1998/12/16 01:38:00 UTC

cvs commit: modperl/src/modules/perl mod_perl.h perl_config.c

dougm       98/12/15 16:38:00

  Modified:    .        Changes ToDo
               src/modules/perl mod_perl.h perl_config.c
  Log:
  fix so "top-level" Perl{Set,Pass}Env works if Perl is started early
  
  Revision  Changes    Path
  1.228     +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.227
  retrieving revision 1.228
  diff -u -r1.227 -r1.228
  --- Changes	1998/12/15 20:18:25	1.227
  +++ Changes	1998/12/16 00:37:56	1.228
  @@ -8,6 +8,8 @@
   
   =item 1.16_03-dev
   
  +fix so "top-level" Perl{Set,Pass}Env works if Perl is started early
  +
   new $r->pnotes method
   
   $ENV{MOD_PERL} is not inherited by subprocesses
  
  
  
  1.132     +0 -2      modperl/ToDo
  
  Index: ToDo
  ===================================================================
  RCS file: /home/cvs/modperl/ToDo,v
  retrieving revision 1.131
  retrieving revision 1.132
  diff -u -r1.131 -r1.132
  --- ToDo	1998/12/14 23:33:59	1.131
  +++ ToDo	1998/12/16 00:37:57	1.132
  @@ -11,8 +11,6 @@
   
   - Perl{Set,Pass}Env tainted, should they not be? (Vivek)
   
  -- Perl{Set,Pass}Env needs to happen asap for "top-level" config (Todd E.)
  -
   - dso + register_cleanup via startup pool
   
   - $r->finfo flaky? (Ken)
  
  
  
  1.67      +10 -0     modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- mod_perl.h	1998/12/15 20:18:27	1.66
  +++ mod_perl.h	1998/12/16 00:37:58	1.67
  @@ -265,6 +265,16 @@
       my_setenv(key, val); \
   }
   
  +#define mp_SetEnv(key, val) \
  +    hv_store(GvHV(envgv), key, strlen(key), newSVpv(val,0), FALSE); \
  +    my_setenv(key, val)
  +
  +#define mp_PassEnv(key) \
  +{ \
  +    char *val = getenv(key); \
  +    hv_store(GvHV(envgv), key, strlen(key), newSVpv(val?val:"",0), FALSE); \
  +}
  +
   #define mp_debug mod_perl_debug_flags
   
   extern U32	mp_debug;
  
  
  
  1.58      +18 -9     modperl/src/modules/perl/perl_config.c
  
  Index: perl_config.c
  ===================================================================
  RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- perl_config.c	1998/12/15 20:18:27	1.57
  +++ perl_config.c	1998/12/16 00:37:58	1.58
  @@ -196,8 +196,7 @@
   
           if(val != NULL) {
   	    MP_TRACE_d(fprintf(stderr, "PerlPassEnv: `%s'=`%s'\n", key, val));
  -	    hv_store(GvHV(envgv), key, strlen(key), newSVpv(val,0), FALSE);
  -	    my_setenv(key, val);
  +	    mp_SetEnv(key,val);
           }
       }
   }    
  @@ -600,9 +599,14 @@
   CHAR_P perl_cmd_pass_env (cmd_parms *parms, void *dummy, char *arg)
   {
       dPSRV(parms->server);
  -    char **new;
  -    new = (char **)push_array(cls->PerlPassEnv);
  -    *new = pstrdup(parms->pool, arg);
  +    if(PERL_RUNNING()) {
  +	mp_PassEnv(arg);
  +    }
  +    else {
  +	char **new;
  +	new = (char **)push_array(cls->PerlPassEnv);
  +	*new = pstrdup(parms->pool, arg);
  +    }
       MP_TRACE_d(fprintf(stderr, "perl_cmd_pass_env: arg=`%s'\n", arg));
       arg = NULL;
       return NULL;
  @@ -628,10 +632,15 @@
       MP_HASENV_on(rec);
       MP_TRACE_d(fprintf(stderr, "perl_cmd_setenv: '%s' = '%s'\n", key, val));
       if(cmd->path == NULL) {
  -	char **new;
  -	dPSRV(cmd->server);
  -	new = (char **)push_array(cls->PerlPassEnv);
  -	*new = pstrcat(cmd->pool, key, ":", val, NULL);
  +	if(PERL_RUNNING()) { 
  +	    mp_SetEnv(key,val);
  +	} 
  +	else { 
  +           char **new; 
  +           dPSRV(cmd->server); 
  +           new = (char **)push_array(cls->PerlPassEnv); 
  +           *new = pstrcat(cmd->pool, key, ":", val, NULL); 
  +	} 
       }
       return NULL;
   }