perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/todo missing_old_features.txt
Date Mon, 19 Nov 2001 00:07:28 GMT
dougm       01/11/18 16:07:28

  Modified:    src/modules/perl mod_perl.c modperl_cmd.c modperl_cmd.h
                        modperl_config.c modperl_env.c modperl_env.h
                        modperl_types.h
               todo     missing_old_features.txt
  Log:
  implement Perl{Set,Pass}Env directives
  
  Revision  Changes    Path
  1.96      +22 -1     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.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- mod_perl.c	2001/11/15 03:02:42	1.95
  +++ mod_perl.c	2001/11/19 00:07:28	1.96
  @@ -28,15 +28,32 @@
   
   #define MP_xs_loader_name "%s::XSLoader::BOOTSTRAP"
   
  +/* ugly hack to have access to startup pool and server during xs_init */
  +static struct {
  +    apr_pool_t *p;
  +    server_rec *s;
  +} MP_boot_data = {NULL,NULL};
  +
  +#define MP_boot_data_set(pool, server) \
  +    MP_boot_data.p = pool; \
  +    MP_boot_data.s = server
  +
  +#define MP_dBOOT_DATA \
  +    apr_pool_t *p = MP_boot_data.p; \
  +    server_rec *s = MP_boot_data.s
  +
   static void modperl_boot(void *data)
   {
  +    MP_dBOOT_DATA;
       dTHX; /* XXX: not too worried since this only happens at startup */
       int i;
  -
  +    
       modperl_env_clear(aTHX);
   
       modperl_env_default_populate(aTHX);
   
  +    modperl_env_configure_server(aTHX_ p, s);
  +
       modperl_perl_core_global_init(aTHX);
   
       for (i=0; MP_xs_loaders[i]; i++) {
  @@ -90,7 +107,9 @@
   
       PL_perl_destruct_level = 2;
   
  +    MP_boot_data_set(p, s);
       status = perl_parse(perl, modperl_xs_init, argc, argv, NULL);
  +    MP_boot_data_set(NULL, NULL);
   
       if (status) {
           perror("perl_parse");
  @@ -423,6 +442,8 @@
       MP_CMD_DIR_ITERATE("PerlInitHandler", init_handlers, "Subroutine name"),
       MP_CMD_DIR_TAKE2("PerlSetVar", set_var, "PerlSetVar"),
       MP_CMD_DIR_ITERATE2("PerlAddVar", add_var, "PerlAddVar"),
  +    MP_CMD_DIR_TAKE2("PerlSetEnv", set_env, "PerlSetEnv"),
  +    MP_CMD_SRV_TAKE1("PerlPassEnv", pass_env, "PerlPassEnv"),
       MP_CMD_SRV_RAW_ARGS("<Perl", perl, "NOT YET IMPLEMENTED"),
   #ifdef MP_TRACE
       MP_CMD_SRV_TAKE1("PerlTrace", trace, "Trace level"),
  
  
  
  1.15      +33 -0     modperl-2.0/src/modules/perl/modperl_cmd.c
  
  Index: modperl_cmd.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- modperl_cmd.c	2001/10/11 04:47:30	1.14
  +++ modperl_cmd.c	2001/11/19 00:07:28	1.15
  @@ -92,6 +92,39 @@
       return NULL;
   }
   
  +MP_CMD_SRV_DECLARE2(set_env)
  +{
  +    MP_dSCFG(parms->server);
  +    modperl_config_dir_t *dcfg = (modperl_config_dir_t *)mconfig;
  + 
  +    MP_TRACE_d(MP_FUNC, "arg1 = %s, arg2 = %s\n", arg1, arg2);
  +
  +    if (!parms->path) {
  +        /* will be propagated to environ */
  +        apr_table_setn(scfg->SetEnv, arg1, arg2);
  +    }
  +
  +    apr_table_setn(dcfg->SetEnv, arg1, arg2);
  +
  +    return NULL;
  +}
  +
  +MP_CMD_SRV_DECLARE(pass_env)
  +{
  +    MP_dSCFG(parms->server);
  +    char *val = getenv(arg);
  + 
  +    if (val) {
  +        apr_table_setn(scfg->PassEnv, arg, apr_pstrdup(parms->pool, val));
  +        MP_TRACE_d(MP_FUNC, "arg = %s, val = %s\n", arg, val);
  +    }
  +    else {
  +        MP_TRACE_d(MP_FUNC, "arg = %s: not found via getenv()\n", arg);
  +    }
  +
  +    return NULL;
  +}
  +
   MP_CMD_SRV_DECLARE(options)
   {
       MP_dSCFG(parms->server);
  
  
  
  1.17      +2 -0      modperl-2.0/src/modules/perl/modperl_cmd.h
  
  Index: modperl_cmd.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- modperl_cmd.h	2001/10/11 04:47:30	1.16
  +++ modperl_cmd.h	2001/11/19 00:07:28	1.17
  @@ -22,6 +22,8 @@
   MP_CMD_SRV_DECLARE(requires);
   MP_CMD_SRV_DECLARE2(set_var);
   MP_CMD_SRV_DECLARE2(add_var);
  +MP_CMD_SRV_DECLARE2(set_env);
  +MP_CMD_SRV_DECLARE(pass_env);
   MP_CMD_SRV_DECLARE(options);
   MP_CMD_SRV_DECLARE(init_handlers);
   MP_CMD_SRV_DECLARE(perl);
  
  
  
  1.48      +10 -0     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.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- modperl_config.c	2001/11/12 22:14:36	1.47
  +++ modperl_config.c	2001/11/19 00:07:28	1.48
  @@ -65,6 +65,8 @@
       merge_item(location);
       
       merge_table_overlap_item(SetVar);
  +    
  +    merge_table_overlap_item(SetEnv);
   
       /* XXX: check if Perl*Handler is disabled */
       for (i=0; i < MP_HANDLER_NUM_PER_DIR; i++) {
  @@ -101,6 +103,9 @@
       scfg->argv = apr_array_make(p, 2, sizeof(char *));
   
       scfg->SetVar = apr_table_make(p, 2);
  +
  +    scfg->PassEnv = apr_table_make(p, 2);
  +    scfg->SetEnv = apr_table_make(p, 2);
       
       modperl_config_srv_argv_push((char *)ap_server_argv0);
   
  @@ -117,6 +122,8 @@
       dcfg->flags = modperl_options_new(p, MpDirType);
   
       dcfg->SetVar = apr_table_make(p, 2);
  +
  +    dcfg->SetEnv = apr_table_make(p, 2);
       
       MP_TRACE_d(MP_FUNC, "0x%lx\n", (unsigned long)dcfg);
   
  @@ -187,6 +194,9 @@
       merge_item(PerlRequire);
   
       merge_table_overlap_item(SetVar);
  +
  +    merge_table_overlap_item(SetEnv);
  +    merge_table_overlap_item(PassEnv);
    
       merge_item(threaded_mpm);
   
  
  
  
  1.20      +27 -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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- modperl_env.c	2001/11/15 03:02:43	1.19
  +++ modperl_env.c	2001/11/19 00:07:28	1.20
  @@ -62,6 +62,30 @@
       modperl_env_tie(mg_flags);
   }
   
  +void modperl_env_configure_server(pTHX_ apr_pool_t *p, server_rec *s)
  +{
  +    /* XXX: propagate scfg->SetEnv to environ */
  +}
  +
  +#define overlay_subprocess_env(r, tab) \
  +    r->subprocess_env = apr_table_overlay(r->pool, \
  +                                          r->subprocess_env, \
  +                                          tab)
  +
  +void modperl_env_configure_request(request_rec *r)
  +{
  +    MP_dDCFG;
  +    MP_dSCFG(r->server);
  +
  +    if (!apr_is_empty_table(dcfg->SetEnv)) {
  +        overlay_subprocess_env(r, dcfg->SetEnv);
  +    }
  +
  +    if (!apr_is_empty_table(scfg->PassEnv)) {
  +        overlay_subprocess_env(r, scfg->PassEnv);
  +    }
  +}
  +
   void modperl_env_default_populate(pTHX)
   {
       modperl_env_ent_t *ent = MP_env_const_vars;
  @@ -93,6 +117,9 @@
       }
   
       MP_TRACE_g(MP_FUNC, "populating environment for %s\n", r->uri);
  +
  +    /* XXX: might want to always do this regardless of PerlOptions -SetupEnv */
  +    modperl_env_configure_request(r);
   
       ap_add_common_vars(r);
       ap_add_cgi_vars(r);
  
  
  
  1.11      +4 -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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- modperl_env.h	2001/11/15 03:02:43	1.10
  +++ modperl_env.h	2001/11/19 00:07:28	1.11
  @@ -15,6 +15,10 @@
   
   void modperl_env_clear(pTHX);
   
  +void modperl_env_configure_server(pTHX_ apr_pool_t *p, server_rec *s);
  +
  +void modperl_env_configure_request(request_rec *r);
  +
   void modperl_env_default_populate(pTHX);
   
   void modperl_env_request_populate(pTHX_ request_rec *r);
  
  
  
  1.54      +2 -1      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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- modperl_types.h	2001/11/05 05:19:01	1.53
  +++ modperl_types.h	2001/11/19 00:07:28	1.54
  @@ -113,7 +113,8 @@
   
   typedef struct {
       MpHV *SetVar;
  -    MpAV *PassEnv;
  +    MpHV *SetEnv;
  +    MpHV *PassEnv;
       MpAV *PerlRequire, *PerlModule;
       MpAV *handlers_per_srv[MP_HANDLER_NUM_PER_SRV];
       MpAV *handlers_files[MP_HANDLER_NUM_FILES];
  
  
  
  1.15      +0 -2      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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- missing_old_features.txt	2001/11/13 06:52:27	1.14
  +++ missing_old_features.txt	2001/11/19 00:07:28	1.15
  @@ -6,8 +6,6 @@
   
   - PerlCleanupHandler
   
  -- PerlSetEnv, PerlPassEnv
  -
   - PerlModule, PerlRequire, Perl{Set,Add}Var in .htaccess is missing
   
   - pod directives (=pod,=back,=cut) and __END__
  
  
  

Mime
View raw message