perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
Date Thu, 12 Dec 2002 10:05:09 GMT
stas        2002/12/12 02:05:08

  Modified:    src/modules/perl mod_perl.c mod_perl.h modperl_config.c
               xs/tables/current/ModPerl FunctionTable.pm
  Log:
  make mod_perl work with vhosts when the server is started prior to
  post_config():
  - call modperl_init_globals as early as possible, because the main server
    record is needed during the configuration parsing, for perlloadmodule
    and vhosts
  - also make sure that we are using a real base_server, when dealing
    with modperl_init, and if not retrieve it from the global record
  
  Revision  Changes    Path
  1.145     +19 -3     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.144
  retrieving revision 1.145
  diff -u -r1.144 -r1.145
  --- mod_perl.c	23 Nov 2002 22:56:21 -0000	1.144
  +++ mod_perl.c	12 Dec 2002 10:05:07 -0000	1.145
  @@ -279,9 +279,25 @@
   void modperl_init(server_rec *base_server, apr_pool_t *p)
   {
       server_rec *s;
  -    modperl_config_srv_t *base_scfg = modperl_config_srv_get(base_server);
  +    modperl_config_srv_t *base_scfg;
       PerlInterpreter *base_perl;
   
  +    /* get the real base server when invoked from vhost.
  +     *
  +     * without doing it segfaults when the first PerlLoadModule
  +     * appears inside vhost, e.g.:
  +     *     <VirtualHost _default_:8535>
  +     *         PerlLoadModule Foo
  +     *     </VirtualHost> 
  +     * an arrangement which is unfortunately hard to automate with our
  +     * test suite, but see test TestDirective::perlloadmodule6
  +     */
  +    if (base_server->is_virtual) {
  +        base_server = modperl_global_get_server_rec();
  +    }
  +
  +    base_scfg = modperl_config_srv_get(base_server);
  +
       MP_TRACE_d_do(MpSrv_dump_flags(base_scfg,
                                      base_server->server_hostname));
   
  @@ -359,7 +375,7 @@
   }
   #endif /* USE_ITHREADS */
   
  -static void modperl_init_globals(server_rec *s, apr_pool_t *pconf)
  +void modperl_init_globals(server_rec *s, apr_pool_t *pconf)
   {
       int threaded_mpm;
       ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm);
  @@ -428,7 +444,7 @@
       modperl_sys_init();
       apr_pool_cleanup_register(pconf, NULL,
                                 modperl_sys_term, apr_pool_cleanup_null);
  -    modperl_init_globals(s, pconf);
  +
       modperl_init(s, pconf);
   
       return OK;
  
  
  
  1.55      +1 -0      modperl-2.0/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- mod_perl.h	15 Sep 2002 23:30:06 -0000	1.54
  +++ mod_perl.h	12 Dec 2002 10:05:08 -0000	1.55
  @@ -74,6 +74,7 @@
   int modperl_init_vhost(server_rec *s, apr_pool_t *p,
                          server_rec *base_server);
   void modperl_init(server_rec *s, apr_pool_t *p);
  +void modperl_init_globals(server_rec *s, apr_pool_t *pconf);
   int modperl_run(apr_pool_t *p, server_rec *s);
   int modperl_is_running(void);
   int modperl_hook_init(apr_pool_t *pconf, apr_pool_t *plog, 
  
  
  
  1.60      +12 -3     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.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- modperl_config.c	9 Dec 2002 07:28:02 -0000	1.59
  +++ modperl_config.c	12 Dec 2002 10:05:08 -0000	1.60
  @@ -164,10 +164,19 @@
   
       ap_mpm_query(AP_MPMQ_IS_THREADED, &scfg->threaded_mpm);
   
  -    /* give a chance to MOD_PERL_TRACE env var to set PerlTrace. This
  -     * place is the earliest point in mod_perl configuration
  -     * parsing, when we have the server object */
       if (!s->is_virtual) {
  +
  +        /* Must store the global server record as early as possible,
  +         * because if mod_perl happens to be started from within a
  +         * vhost (e.g., PerlLoadModule) the base server record won't
  +         * be availalbe to vhost and things will blow up
  +         */
  +        modperl_init_globals(s, p);
  +
  +        /* give a chance to MOD_PERL_TRACE env var to set
  +         * PerlTrace. This place is the earliest point in mod_perl
  +         * configuration parsing, when we have the server object
  +         */
           modperl_trace_level_set(s, NULL);
       }
       
  
  
  
  1.89      +14 -0     modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- FunctionTable.pm	8 Dec 2002 01:57:49 -0000	1.88
  +++ FunctionTable.pm	12 Dec 2002 10:05:08 -0000	1.89
  @@ -2281,6 +2281,20 @@
       ]
     },
     {
  +    'return_type' => 'void',
  +    'name' => 'modperl_init_globals',
  +    'args' => [
  +      {
  +        'type' => 'server_rec *',
  +        'name' => 's'
  +      },
  +      {
  +        'type' => 'apr_pool_t *',
  +        'name' => 'pconf'
  +      }
  +    ]
  +  },
  +  {
       'return_type' => 'apr_status_t',
       'name' => 'modperl_input_filter_handler',
       'args' => [
  
  
  

Mime
View raw message