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/06/16 20:50:02 UTC

cvs commit: modperl/src/modules/perl Apache.xs mod_perl.h perl_util.c

dougm       98/06/16 11:50:00

  Modified:    .        Changes
               lib/Apache Registry.pm RegistryLoader.pm
               src/modules/perl Apache.xs mod_perl.h perl_util.c
  Log:
  Apache::Registry will now save END blocks just after the script is compiled,
  instead of after the subroutine call.  otherwise, if the client breaks the
  connection, the hard_timeout will jump out of perl_handler(), and the save
  will never happen.  Thanks to Robert Nice and Ben Laurie for spotting this.
  
  Revision  Changes    Path
  1.50      +5 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /export/home/cvs/modperl/Changes,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- Changes	1998/06/15 22:52:09	1.49
  +++ Changes	1998/06/16 18:49:56	1.50
  @@ -8,6 +8,11 @@
   
   =item 1.12_01-dev
   
  +Apache::Registry will now save END blocks just after the script is compiled,
  +instead of after the subroutine call.  otherwise, if the client breaks the
  +connection, the hard_timeout will jump out of perl_handler(), and the save 
  +will never happen.  Thanks to Robert Nice and Ben Laurie for spotting this.
  +
   bug fix so PATH_INFO is properly reset, thanks to David Sklar for the spot
   
   =item 1.12 - June 14, 1998
  
  
  
  1.10      +3 -2      modperl/lib/Apache/Registry.pm
  
  Index: Registry.pm
  ===================================================================
  RCS file: /export/home/cvs/modperl/lib/Apache/Registry.pm,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Registry.pm	1998/06/11 08:42:42	1.9
  +++ Registry.pm	1998/06/16 18:49:58	1.10
  @@ -3,8 +3,8 @@
   #use strict; #eval'd scripts will inherit hints
   use Apache::Constants qw(:common &OPT_EXECCGI &REDIRECT);
   
  -#$Id: Registry.pm,v 1.9 1998/06/11 08:42:42 rse Exp $
  -$Apache::Registry::VERSION = (qw$Revision: 1.9 $)[1];
  +#$Id: Registry.pm,v 1.10 1998/06/16 18:49:58 dougm Exp $
  +$Apache::Registry::VERSION = (qw$Revision: 1.10 $)[1];
   
   $Apache::Registry::Debug ||= 0;
   # 1 => log recompile in errorlog
  @@ -120,6 +120,7 @@
   			    "\n}", # last line comment without newline?
   			   );
   	    compile($eval);
  +	    $r->stash_rgy_endav($script_name);
   	    if ($@) {
   		$r->log_error($@);
   		$@{$r->uri} = $@;
  
  
  
  1.8       +2 -1      modperl/lib/Apache/RegistryLoader.pm
  
  Index: RegistryLoader.pm
  ===================================================================
  RCS file: /export/home/cvs/modperl/lib/Apache/RegistryLoader.pm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RegistryLoader.pm	1998/05/10 08:45:56	1.7
  +++ RegistryLoader.pm	1998/06/16 18:49:58	1.8
  @@ -5,7 +5,7 @@
   use Apache::Registry ();
   use Apache::Constants qw(OPT_EXECCGI);
   @Apache::RegistryLoader::ISA = qw(Apache::Registry);
  -$Apache::RegistryLoader::VERSION = (qw$Revision: 1.7 $)[1];
  +$Apache::RegistryLoader::VERSION = (qw$Revision: 1.8 $)[1];
   
   sub new { 
       my $class = shift;
  @@ -45,6 +45,7 @@
   *log_reason = \&log_error; 
   sub allow_options { OPT_EXECCGI } #will be checked again at run-time
   sub clear_rgy_endav {}
  +sub stash_rgy_endav {}
   sub request {}
   sub seqno {0} 
   sub server { shift }
  
  
  
  1.31      +8 -0      modperl/src/modules/perl/Apache.xs
  
  Index: Apache.xs
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/Apache.xs,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Apache.xs	1998/06/05 02:08:17	1.30
  +++ Apache.xs	1998/06/16 18:49:59	1.31
  @@ -433,6 +433,14 @@
       Apache     r
       SV *sv
   
  +void
  +mod_perl_stash_rgy_endav(r, sv=APACHE_REGISTRY_CURSTASH)
  +    Apache     r
  +    SV *sv
  +
  +    CODE:
  +    perl_stash_rgy_endav(r->uri, sv);
  +
   I32
   module(sv, name)
       SV *sv
  
  
  
  1.27      +1 -0      modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_perl.h	1998/06/07 17:58:50	1.26
  +++ mod_perl.h	1998/06/16 18:49:59	1.27
  @@ -898,6 +898,7 @@
   void perl_tie_hash(HV *hv, char *class, SV *sv);
   void perl_util_cleanup(void);
   void mod_perl_clear_rgy_endav(request_rec *r, SV *sv);
  +void perl_stash_rgy_endav(char *s, SV *rgystash);
   void perl_run_rgy_endav(char *s);
   void perl_run_endav(char *s);
   void perl_call_halt(int status);
  
  
  
  1.13      +32 -5     modperl/src/modules/perl/perl_util.c
  
  Index: perl_util.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/perl_util.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- perl_util.c	1998/06/15 22:52:10	1.12
  +++ perl_util.c	1998/06/16 18:49:59	1.13
  @@ -215,17 +215,19 @@
       }
   }
   
  -void perl_run_rgy_endav(char *s) 
  +void perl_stash_rgy_endav(char *s, SV *rgystash)
   {
  -    SV *rgystash = perl_get_sv("Apache::Registry::curstash", FALSE);
       AV *rgyendav = Nullav;
       STRLEN klen;
       char *key;
       dTHR;
   
  +    if(!rgystash) 
  +	rgystash = perl_get_sv("Apache::Registry::curstash", FALSE);
  +
       if(!rgystash || !SvTRUE(rgystash)) {
   	MP_TRACE_g(fprintf(stderr, 
  -        "Apache::Registry::curstash not set, can't run END blocks for %s\n",
  +        "Apache::Registry::curstash not set, can't stash END blocks for %s\n",
   			 s));
   	return;
       }
  @@ -256,12 +258,37 @@
   	}
       }
   
  +    if(rgyendav)
  +	hv_store(mod_perl_endhv, key, klen, (SV*)newRV((SV*)rgyendav), FALSE);
  +}
  +
  +void perl_run_rgy_endav(char *s) 
  +{
  +    SV *rgystash = perl_get_sv("Apache::Registry::curstash", FALSE);
  +    AV *rgyendav = Nullav;
  +    STRLEN klen;
  +    char *key;
  +    dTHR;
  +
  +    if(!rgystash || !SvTRUE(rgystash)) {
  +	MP_TRACE_g(fprintf(stderr, 
  +        "Apache::Registry::curstash not set, can't run END blocks for %s\n",
  +			 s));
  +	return;
  +    }
  +
  +    key = SvPV(rgystash,klen);
  +
  +    if(hv_exists(mod_perl_endhv, key, klen)) {
  +	SV *entry = *hv_fetch(mod_perl_endhv, key, klen, FALSE);
  +	if(SvTRUE(entry) && SvROK(entry)) 
  +	    rgyendav = (AV*)SvRV(entry);
  +    }
  +
       MP_TRACE_g(fprintf(stderr, 
   	     "running %d END blocks for %s\n", rgyendav ? (int)AvFILL(rgyendav)+1 : 0, s));
       if((endav = rgyendav)) 
   	perl_run_blocks(scopestack_ix, endav);
  -    if(rgyendav)
  -	hv_store(mod_perl_endhv, key, klen, (SV*)newRV((SV*)rgyendav), FALSE);
       
       sv_setpv(rgystash,"");
   }