perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@hyperreal.org
Subject cvs commit: modperl/src/modules/perl perl_config.c
Date Sun, 08 Nov 1998 01:21:13 GMT
dougm       98/11/07 17:21:13

  Modified:    .        Changes
               t/conf   httpd.conf.pl
               src/modules/perl perl_config.c
  Log:
  allow $VirtualHost{'111.22.33.55'} = [...] syntax in <Perl> sections
  
  Revision  Changes    Path
  1.188     +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /export/home/cvs/modperl/Changes,v
  retrieving revision 1.187
  retrieving revision 1.188
  diff -u -r1.187 -r1.188
  --- Changes	1998/11/06 20:18:42	1.187
  +++ Changes	1998/11/08 01:21:11	1.188
  @@ -8,6 +8,8 @@
   
   =item 1.16_01-dev
   
  +allow $VirtualHost{'111.22.33.55'} = [...] syntax in <Perl> sections
  +
   Perl*Handler commands will now call perl_startup() if Perl is not
   already running to cure dso problem [Daniel Jacobowitz <drow+@cs.cmu.edu>]
   
  
  
  
  1.22      +49 -21    modperl/t/conf/httpd.conf.pl
  
  Index: httpd.conf.pl
  ===================================================================
  RCS file: /export/home/cvs/modperl/t/conf/httpd.conf.pl,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- httpd.conf.pl	1998/10/30 04:37:32	1.21
  +++ httpd.conf.pl	1998/11/08 01:21:12	1.22
  @@ -9,16 +9,13 @@
   
   Action text/perl-module /perl/action.pl
   
  -PerlPassEnv TEST_PERL_DIRECTIVES
  +PerlRequire docs/startup.pl
  +PerlRequire docs/stacked.pl
   
  -#these three are passed to perl_parse(), 
  -#which happens before <Perl> sections are processed
  -#optionally, they can be inside <Perl>, however for testing we want
  -#warnings and taint checks on while processing <Perl>
  -#besides that, we rely on the PerlScript below to set @INC to our blib
  +PerlSetEnv Tops Uno
  +PerlChildInitHandler "sub { die 'PerlSetEnv busted' unless $ENV{Tops} eq 'Uno' }"
   
  -PerlScript docs/startup.pl
  -PerlScript docs/stacked.pl
  +PerlPassEnv TEST_PERL_DIRECTIVES
   
   #-Tw
   PerlTaintCheck On
  @@ -157,20 +154,51 @@
       Options    => "ExecCGI",
   };
   
  -$VirtualHost{"localhost"} = {
  -    Location => {
  -	"/perl/io" => {
  -	    @mod_perl,
  -	    PerlSendHeader => "On",
  -	    PerlSetupEnv   => "On",
  -	},
  -	"/perl_xs/io" => {
  -	    @mod_perl,
  -	    PerlSendHeader => "On",
  -	    PerlSetupEnv   => "On",
  +#just make sure we can parse this
  +
  +chomp(my $hostname = `hostname`);
  +if($hostname =~ /ramona/) {
  +    $NameVirtualHost = '209.228.11.20:8529';
  +    $VirtualHost{"$NameVirtualHost:8529"} = [
  +       {
  +	   ServerName   => 'ramona.criticalpath.net',
  +	   DocumentRoot => '/home/ix',
  +	   ServerAdmin => 'ix',
  +       },
  +       {
  +	   ServerName   => 'ramona.eng.cp.net',
  +	   DocumentRoot => '/home/dougm',
  +	   ServerAdmin => 'dougm',
  +       },
  +    ];
  +
  +    $Location{"/perl/io"} = {
  +	@mod_perl,
  +	PerlSendHeader => "On",
  +	PerlSetupEnv   => "On",
  +    };
  +    $Location{"/perl_xs/io"} = {
  +	@mod_perl,
  +	PerlSendHeader => "On",
  +	PerlSetupEnv   => "On",
  +    };
  +}
  +else {
  +    $VirtualHost{"localhost"} = {
  +	Location => {
  +	    "/perl/io" => {
  +		@mod_perl,
  +		PerlSendHeader => "On",
  +		PerlSetupEnv   => "On",
  +	    },
  +	    "/perl_xs/io" => {
  +		@mod_perl,
  +		PerlSendHeader => "On",
  +		PerlSetupEnv   => "On",
  +	    },
   	},
  -    },
  -};
  +    };
  +}
   
   #$Location{"/perl/io"} = {
   #    @mod_perl,
  
  
  
  1.42      +51 -8     modperl/src/modules/perl/perl_config.c
  
  Index: perl_config.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/perl_config.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- perl_config.c	1998/11/05 04:09:21	1.41
  +++ perl_config.c	1998/11/08 01:21:13	1.42
  @@ -353,6 +353,7 @@
   #else
   static void mp_preload_module(char **name)
   {
  +    if(ind(*name, ' ') >= 0) return;
       if(**name == '-' && ++*name) return;
       if(**name == '+') ++*name;
       else if(!PERL_AUTOPRELOAD) return;
  @@ -904,16 +905,39 @@
   #define dSECiter_start \
       (void)hv_iterinit(hv); \
       while ((val = hv_iternextsv(hv, (char **) &key, &klen))) { \
  -	HV *tab; \
  -        if(SvROK(val) && (SvTYPE(SvRV(val)) != SVt_PVHV)) \
  -             croak("value of `%s' is not a HASH reference!", key); \
  +        HV *tab = Nullhv; \
  +        AV *list = Nullav; \
   	if(SvMAGICAL(val)) mg_get(val); \
  -	if((tab = (HV *)SvRV(val))) { 
  +	if(SvROK(val) && (SvTYPE(SvRV(val)) == SVt_PVHV)) \
  +	    tab = (HV *)SvRV(val); \
  +	else if(SvROK(val) && (SvTYPE(SvRV(val)) == SVt_PVAV)) \
  +	    list = (AV *)SvRV(val); \
  +	else \
  +	    croak("value of `%s' is not a HASH or ARRAY reference!", key); \
  +	if(list || tab) { \
   
   #define dSECiter_stop \
           } \
       }
   
  +#define SECiter_list(t) \
  +{ \
  +    I32 i; \
  +    for(i=0; i<=AvFILL(list); i++) { \
  +        SV *rv = *av_fetch(list, i, FALSE); \
  +        HV *nhv; \
  +        if(!SvROK(rv) || (SvTYPE(SvRV(rv)) != SVt_PVHV)) \
  +   	    croak("not a HASH reference!"); \
  +        nhv = newHV(); \
  +        hv_store(nhv, (char*)key, klen, rv, FALSE); \
  +        tab = nhv; \
  +        t; \
  +        SvREFCNT_dec(nhv); \
  +    } \
  +    list = Nullav; \
  +    continue; \
  +}
  +
   void perl_section_hash_walk(cmd_parms *cmd, void *cfg, HV *hv)
   {
       CHAR_P errmsg;
  @@ -953,6 +977,9 @@
   #define TRACE_SECTION(n,v) \
       MP_TRACE_s(fprintf(stderr, "perl_section: <%s %s>\n", n, v))
   
  +#define TRACE_SECTION_END(n) \
  +    MP_TRACE_s(fprintf(stderr, "perl_section: </%s>\n", n))
  +
   /* XXX, had to copy-n-paste much code from http_core.c for
    * perl_*sections, would be nice if the core config routines 
    * had a handful of callback hooks instead
  @@ -967,6 +994,10 @@
       const char *errmsg = NULL;
       dSECiter_start
   
  +    if(list) {
  +	SECiter_list(perl_virtualhost_section(cmd, dummy, tab));
  +    }
  +
       arg = pstrdup(cmd->pool, getword_conf (cmd->pool, &key));
   
   #if MODULE_MAGIC_NUMBER >= 19970912
  @@ -989,7 +1020,7 @@
       cmd->server = main_server;
   
       dSECiter_stop
  -
  +    TRACE_SECTION_END("VirtualHost");
       return NULL;
   }
   
  @@ -1023,6 +1054,10 @@
       regex_t *r = NULL;
   
       void *new_url_conf = create_per_dir_config (cmd->pool);
  +
  +    if(list) {
  +	SECiter_list(perl_urlsection(cmd, dummy, tab));
  +    }
       
       cmd->path = pstrdup(cmd->pool, getword_conf (cmd->pool, &key));
       cmd->override = OR_ALL|ACCESS_CONF;
  @@ -1052,7 +1087,7 @@
   
       cmd->path = old_path;
       cmd->override = old_overrides;
  -
  +    TRACE_SECTION_END("Location");
       return NULL;
   }
   
  @@ -1068,6 +1103,10 @@
       void *new_dir_conf = create_per_dir_config (cmd->pool);
       regex_t *r = NULL;
   
  +    if(list) {
  +	SECiter_list(perl_dirsection(cmd, dummy, tab));
  +    }
  +
       cmd->path = pstrdup(cmd->pool, getword_conf (cmd->pool, &key));
   
   #ifdef __EMX__
  @@ -1096,7 +1135,7 @@
   
       cmd->path = old_path;
       cmd->override = old_overrides;
  -
  +    TRACE_SECTION_END("Directory");
       return NULL;
   }
   
  @@ -1121,6 +1160,10 @@
       void *new_file_conf = create_per_dir_config (cmd->pool);
       regex_t *r = NULL;
   
  +    if(list) {
  +	SECiter_list(perl_filesection(cmd, dummy, tab));
  +    }
  +
       cmd->path = pstrdup(cmd->pool, getword_conf (cmd->pool, &key));
       /* Only if not an .htaccess file */
       if (cmd->path)
  @@ -1151,7 +1194,7 @@
       perl_add_file_conf (cmd->server, new_file_conf);
   
       dSECiter_stop
  -
  +    TRACE_SECTION_END("Files");
       cmd->path = old_path;
       cmd->override = old_overrides;
   
  
  
  

Mime
View raw message