cvs commit: modperl-2.0/src/modules/perl modperl_interp.c

2002-11-23 Thread dougm
dougm   2002/11/23 15:25:33

  Modified:.Changes
   src/modules/perl modperl_interp.c
  Log:
  Submitted by: Stephen Clouse <[EMAIL PROTECTED]>
  Reviewed by:  dougm
  fix for directive handlers within vhosts using threaded MPMs
  
  Revision  ChangesPath
  1.61  +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- Changes   23 Nov 2002 22:56:21 -  1.60
  +++ Changes   23 Nov 2002 23:25:32 -  1.61
  @@ -10,6 +10,9 @@
   
   =item 1.99_08-dev
   
  +fix for directive handlers within vhosts using threaded MPMs
  +[Stephen Clouse <[EMAIL PROTECTED]>]
  +
   fix  support
   
   default AuthType to Basic if not set in $r->get_basic_auth_pw()
  
  
  
  1.54  +8 -0  modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- modperl_interp.c  22 Oct 2002 03:56:30 -  1.53
  +++ modperl_interp.c  23 Nov 2002 23:25:32 -  1.54
  @@ -323,6 +323,14 @@
   if (scfg && (is_startup || !scfg->threaded_mpm)) {
   MP_TRACE_i(MP_FUNC, "using parent interpreter at %s\n",
  is_startup ? "startup" : "request time (non-threaded MPM)");
  +
  +if (!scfg->mip) {
  +/* we get here if directive handlers are invoked
  + * before server merge.
  + */
  +modperl_init_vhost(s, p, NULL);
  +}
  +
   interp = scfg->mip->parent;
   }
   else {
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_interp.c

2002-10-21 Thread dougm
dougm   2002/10/21 20:56:30

  Modified:.Changes
   src/modules/perl modperl_interp.c
  Log:
  workaround glibc/Perl-5.8.0 crypt but with threaded MPMs
  
  Revision  ChangesPath
  1.57  +2 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Changes   22 Oct 2002 02:42:03 -  1.56
  +++ Changes   22 Oct 2002 03:56:30 -  1.57
  @@ -10,6 +10,8 @@
   
   =item 1.99_08-dev
   
  +workaround glibc/Perl-5.8.0 crypt() bug (seen with threaded MPMs)
  +
   fix delete $ENV{$key} bug
   
   fix parse_args compat method to support non-ascii characters
  
  
  
  1.53  +8 -0  modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- modperl_interp.c  27 Aug 2002 04:24:08 -  1.52
  +++ modperl_interp.c  22 Oct 2002 03:56:30 -  1.53
  @@ -63,6 +63,14 @@
   
   interp->perl = perl_clone(perl, clone_flags);
   
  +#if defined(USE_REENTRANT_API) && defined(HAS_CRYPT_R) && defined(__GLIBC__)
  +{
  +dTHXa(interp->perl);
  +/* workaround 5.8.0 bug */
  +PL_reentrant_buffer->_crypt_struct.current_saltbits = 0;
  +}
  +#endif
  +
   {
   PTR_TBL_t *source = modperl_module_config_table_get(perl, FALSE);
   if (source) {
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_interp.c modperl_perl.c

2002-08-26 Thread dougm

dougm   2002/08/26 21:24:08

  Modified:src/modules/perl modperl_interp.c modperl_perl.c
  Log:
  clone/destroy modperl_module_config_table if it exists (directive handler support)
  
  Revision  ChangesPath
  1.52  +22 -1 modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- modperl_interp.c  27 Aug 2002 01:43:25 -  1.51
  +++ modperl_interp.c  27 Aug 2002 04:24:08 -  1.52
  @@ -38,7 +38,7 @@
   modperl_interp_t *modperl_interp_new(modperl_interp_pool_t *mip,
PerlInterpreter *perl)
   {
  -UV clone_flags = 0;
  +UV clone_flags = CLONEf_KEEP_PTR_TABLE;
   modperl_interp_t *interp = 
   (modperl_interp_t *)malloc(sizeof(*interp));
   
  @@ -62,6 +62,27 @@
   PERL_SET_CONTEXT(perl);
   
   interp->perl = perl_clone(perl, clone_flags);
  +
  +{
  +PTR_TBL_t *source = modperl_module_config_table_get(perl, FALSE);
  +if (source) {
  +PTR_TBL_t *table = modperl_svptr_table_clone(interp->perl,
  + perl,
  + source);
  +
  +modperl_module_config_table_set(interp->perl, table);
  +}
  +}
  +
  +/*
  + * we keep the PL_ptr_table past perl_clone so it can be used
  + * within modperl_svptr_table_clone.
  + */
  +if ((clone_flags & CLONEf_KEEP_PTR_TABLE)) {
  +dTHXa(interp->perl);
  +ptr_table_free(PL_ptr_table);
  +PL_ptr_table = NULL;
  +}
   
   modperl_interp_clone_init(interp);
   
  
  
  
  1.16  +5 -0  modperl-2.0/src/modules/perl/modperl_perl.c
  
  Index: modperl_perl.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- modperl_perl.c27 Aug 2002 01:46:27 -  1.15
  +++ modperl_perl.c27 Aug 2002 04:24:08 -  1.16
  @@ -86,6 +86,7 @@
   void modperl_perl_destruct(PerlInterpreter *perl)
   {
   char **orig_environ = NULL;
  +PTR_TBL_t *module_commands; 
   dTHXa(perl);
   
   PERL_SET_CONTEXT(perl);
  @@ -116,6 +117,10 @@
   
   if (PL_endav) {
   modperl_perl_call_list(aTHX_ PL_endav, "END");
  +}
  +
  +if ((module_commands = modperl_module_config_table_get(perl, FALSE))) {
  +modperl_svptr_table_destroy(perl, module_commands);
   }
   
   perl_destruct(perl);
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_interp.c modperl_interp.h

2002-08-26 Thread dougm

dougm   2002/08/26 18:43:25

  Modified:src/modules/perl modperl_interp.c modperl_interp.h
  Log:
  add functions for getting/setting an interp within a pool,
  in the case where we don't have a request_rec or conn_rec,
  such as for directive handlers per-{dir,srv} create and merge.
  
  Revision  ChangesPath
  1.51  +58 -4 modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- modperl_interp.c  21 Jun 2002 04:16:51 -  1.50
  +++ modperl_interp.c  27 Aug 2002 01:43:25 -  1.51
  @@ -255,7 +255,63 @@
   #define MP_INTERP_KEY "MODPERL_INTERP"
   
   #define get_interp(p) \
  -(void)apr_pool_userdata_get((void **)&interp, MP_INTERP_KEY, p)
  +(void)apr_pool_userdata_get((void **)&interp, MP_INTERP_KEY, p)
  +
  +#define set_interp(p) \
  + (void)apr_pool_userdata_set((void *)interp, MP_INTERP_KEY, \
  + modperl_interp_unselect, \
  + p)
  +
  +modperl_interp_t *modperl_interp_pool_get(apr_pool_t *p)
  +{
  +modperl_interp_t *interp = NULL;
  +get_interp(p);
  +return interp;
  +}
  +
  +void modperl_interp_pool_set(apr_pool_t *p,
  + modperl_interp_t *interp,
  + int cleanup)
  +{
  +/* same as get_interp but optional cleanup  */
  +(void)apr_pool_userdata_set((void *)interp, MP_INTERP_KEY,
  +cleanup ? modperl_interp_unselect : NULL,
  +p);
  +}
  +
  +/*
  + * used in the case where we don't have a request_rec or conn_rec,
  + * such as for directive handlers per-{dir,srv} create and merge.
  + * "request time pool" is most likely a request_rec->pool.
  + */
  +modperl_interp_t *modperl_interp_pool_select(apr_pool_t *p,
  + server_rec *s)
  +{
  +int is_startup = (p == s->process->pconf);
  +MP_dSCFG(s);
  +modperl_interp_t *interp = NULL;
  +
  +if (scfg && (is_startup || !scfg->threaded_mpm)) {
  +MP_TRACE_i(MP_FUNC, "using parent interpreter at %s\n",
  +   is_startup ? "startup" : "request time (non-threaded MPM)");
  +interp = scfg->mip->parent;
  +}
  +else {
  +if (!(interp = modperl_interp_pool_get(p))) {
  +interp = modperl_interp_get(s);
  +modperl_interp_pool_set(p, interp, TRUE);
  +
  +MP_TRACE_i(MP_FUNC, "set interp in request time pool 0x%lx\n",
  +   (unsigned long)p);
  +}
  +else {
  +MP_TRACE_i(MP_FUNC, "found interp in request time pool 0x%lx\n",
  +   (unsigned long)p);
  +}
  +}
  +
  +return interp;
  +}
   
   modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c,
   server_rec *s)
  @@ -379,9 +435,7 @@
   return NULL;
   }
   
  -(void)apr_pool_userdata_set((void *)interp, MP_INTERP_KEY,
  -modperl_interp_unselect,
  -p);
  +set_interp(p);
   
   MP_TRACE_i(MP_FUNC,
  "set interp 0x%lx in %s 0x%lx (%s request for %s)\n",
  
  
  
  1.18  +9 -0  modperl-2.0/src/modules/perl/modperl_interp.h
  
  Index: modperl_interp.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- modperl_interp.h  7 Jul 2002 23:47:35 -   1.17
  +++ modperl_interp.h  27 Aug 2002 01:43:25 -  1.18
  @@ -32,6 +32,15 @@
   
   apr_status_t modperl_interp_unselect(void *data);
   
  +modperl_interp_t *modperl_interp_pool_get(apr_pool_t *p);
  +
  +void modperl_interp_pool_set(apr_pool_t *p,
  + modperl_interp_t *interp,
  + int cleanup);
  +
  +modperl_interp_t *modperl_interp_pool_select(apr_pool_t *p,
  + server_rec *s);
  +
   modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c,
   server_rec *s);
   
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_interp.c

2002-06-20 Thread dougm

dougm   2002/06/20 20:46:46

  Modified:src/modules/perl modperl_interp.c
  Log:
  cannot dereference mip->parent after it has been free-d
  
  Revision  ChangesPath
  1.49  +0 -2  modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- modperl_interp.c  21 Jun 2002 03:02:54 -  1.48
  +++ modperl_interp.c  21 Jun 2002 03:46:46 -  1.49
  @@ -152,8 +152,6 @@
   modperl_interp_destroy(mip->parent);
   }
   
  -mip->parent->perl = NULL;
  -
   modperl_env_unload();
   
   modperl_perl_pp_unset_all();
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_interp.c modperl_interp.h modperl_tipool.c modperl_tipool.h modperl_types.h

2002-06-20 Thread dougm

dougm   2002/06/20 20:02:54

  Modified:src/modules/perl modperl_interp.c modperl_interp.h
modperl_tipool.c modperl_tipool.h modperl_types.h
  Log:
  stop using an apr_pool_t to allocate items for the interpreter pool:
  -even though we lock, the pool is read by modules other than mod_perl
  -when a PerlInterpreter is released to to PerlInterp{MaxRequests,MinSpare}
  the pool item allocation "leaks" because the server pool is not
  cleared until restart
  
  Revision  ChangesPath
  1.48  +9 -7  modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- modperl_interp.c  21 Jun 2002 00:44:24 -  1.47
  +++ modperl_interp.c  21 Jun 2002 03:02:54 -  1.48
  @@ -35,14 +35,15 @@
   modperl_xs_dl_handles_clear(aTHX);
   }
   
  -modperl_interp_t *modperl_interp_new(apr_pool_t *p,
  - modperl_interp_pool_t *mip,
  +modperl_interp_t *modperl_interp_new(modperl_interp_pool_t *mip,
PerlInterpreter *perl)
   {
   UV clone_flags = 0;
   modperl_interp_t *interp = 
  -(modperl_interp_t *)apr_pcalloc(p, sizeof(*interp));
  -
  +(modperl_interp_t *)malloc(sizeof(*interp));
  +
  +memset(interp, '\0', sizeof(*interp));
  +
   interp->mip = mip;
   interp->refcnt = 0; /* for use by APR::Pool->cleanup_register */
   
  @@ -97,6 +98,8 @@
   modperl_perl_destruct(interp->perl);
   
   modperl_xs_dl_handles_close(handles);
  +
  +free(interp);
   }
   
   apr_status_t modperl_interp_cleanup(void *data)
  @@ -162,7 +165,7 @@
   {
   modperl_interp_pool_t *mip = (modperl_interp_pool_t *)data;
   MP_TRACE_i(MP_FUNC, "adding new interpreter to the pool\n");
  -return (void *)modperl_interp_new(mip->ap_pool, mip, mip->parent->perl);
  +return (void *)modperl_interp_new(mip, mip->parent->perl);
   }
   
   static void interp_pool_shrink(modperl_tipool_t *tipool, void *data,
  @@ -206,9 +209,8 @@
  &interp_pool_func, mip);
   
   mip->tipool = tipool;
  -mip->ap_pool = p;
   mip->server  = s;
  -mip->parent = modperl_interp_new(p, mip, NULL);
  +mip->parent = modperl_interp_new(mip, NULL);
   aTHX = mip->parent->perl = perl;
   
   /* this happens post-config in mod_perl.c:modperl_init_clones() */
  
  
  
  1.16  +1 -2  modperl-2.0/src/modules/perl/modperl_interp.h
  
  Index: modperl_interp.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- modperl_interp.h  13 Jun 2002 02:59:05 -  1.15
  +++ modperl_interp.h  21 Jun 2002 03:02:54 -  1.16
  @@ -23,8 +23,7 @@
   
   void modperl_interp_clone_init(modperl_interp_t *interp);
   
  -modperl_interp_t *modperl_interp_new(apr_pool_t *p,
  - modperl_interp_pool_t *mip,
  +modperl_interp_t *modperl_interp_new(modperl_interp_pool_t *mip,
PerlInterpreter *perl);
   
   void modperl_interp_destroy(modperl_interp_t *interp);
  
  
  
  1.8   +6 -4  modperl-2.0/src/modules/perl/modperl_tipool.c
  
  Index: modperl_tipool.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_tipool.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- modperl_tipool.c  8 Mar 2002 02:48:01 -   1.7
  +++ modperl_tipool.c  21 Jun 2002 03:02:54 -  1.8
  @@ -15,10 +15,11 @@
* this is another "proof-of-concept", plenty of room for improvement here
*/
   
  -modperl_list_t *modperl_list_new(apr_pool_t *p)
  +modperl_list_t *modperl_list_new()
   {
   modperl_list_t *listp = 
  -(modperl_list_t *)apr_pcalloc(p, sizeof(*listp));
  +(modperl_list_t *)malloc(sizeof(*listp));
  +memset(listp, '\0', sizeof(*listp));
   return listp;
   }
   
  @@ -151,7 +152,6 @@
   modperl_tipool_t *tipool =
   (modperl_tipool_t *)apr_pcalloc(p, sizeof(*tipool));
   
  -tipool->ap_pool = p;
   tipool->cfg = cfg;
   tipool->func = func;
   tipool->data = data;
  @@ -201,7 +201,7 @@
   
   void modperl_tipool_add(modperl_tipool_t *tipool, void *data)
   {
  -modperl_list_t *listp = modperl_list_new(tipool->ap_pool);
  +modperl_list_t *listp = modperl_list_new();
   
   listp->data = data;
   
  @@ -339,6 +339,8 @@
   (*tipool->func->tipool_destroy)(tipool, tipool->data,
   listp->data);
   }
  +
  +free

cvs commit: modperl-2.0/src/modules/perl modperl_interp.c

2002-06-12 Thread dougm

dougm   2002/06/12 20:05:06

  Modified:src/modules/perl modperl_interp.c
  Log:
  no need to check #ifdef USE_ITHREADS and scfg->threaded_mpm before
  MP_THX_INTERP_SET as both have already been done prior.
  
  Revision  ChangesPath
  1.44  +1 -5  modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- modperl_interp.c  13 Jun 2002 02:59:05 -  1.43
  +++ modperl_interp.c  13 Jun 2002 03:05:06 -  1.44
  @@ -404,11 +404,7 @@
   /* set context (THX) for this thread */
   PERL_SET_CONTEXT(interp->perl);
   
  -#ifdef USE_ITHREADS
  -if (scfg->threaded_mpm) {
  -MP_THX_INTERP_SET(interp->perl, interp);
  -}
  -#endif
  +MP_THX_INTERP_SET(interp->perl, interp);
   
   return interp;
   }
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_interp.c

2002-05-11 Thread dougm

dougm   02/05/11 13:01:09

  Modified:src/modules/perl modperl_interp.c
  Log:
  win32/bleedperl perl_clone needs the CLONEf_CLONE_HOST flag
  
  Revision  ChangesPath
  1.41  +6 -1  modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- modperl_interp.c  11 May 2002 17:17:34 -  1.40
  +++ modperl_interp.c  11 May 2002 20:01:09 -  1.41
  @@ -39,6 +39,7 @@
modperl_interp_pool_t *mip,
PerlInterpreter *perl)
   {
  +UV clone_flags = 0;
   modperl_interp_t *interp = 
   (modperl_interp_t *)apr_pcalloc(p, sizeof(*interp));
   
  @@ -52,7 +53,11 @@
   );
   #endif
   
  -interp->perl = perl_clone(perl, FALSE);
  +#if defined(WIN32) && defined(CLONEf_CLONE_HOST)
  +clone_flags |= CLONEf_CLONE_HOST;
  +#endif
  +
  +interp->perl = perl_clone(perl, clone_flags);
   
   modperl_interp_clone_init(interp);
   
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_interp.c

2002-05-11 Thread dougm

dougm   02/05/11 10:17:34

  Modified:src/modules/perl modperl_interp.c
  Log:
  need to PERL_SET_CONTEXT before modperl_xs_dl_handles_get does av_clear,
  else segv
  
  Revision  ChangesPath
  1.40  +2 -0  modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- modperl_interp.c  8 Jan 2002 01:13:28 -   1.39
  +++ modperl_interp.c  11 May 2002 17:17:34 -  1.40
  @@ -76,6 +76,8 @@
   apr_array_header_t *handles;
   dTHXa(interp->perl);
   
  +PERL_SET_CONTEXT(interp->perl);
  +
   MP_TRACE_i(MP_FUNC, "interp == 0x%lx\n",
  (unsigned long)interp);