tcl-mod_dtcl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject cvs commit: tcl-moddtcl builddtcl.sh mod_dtcl.c
Date Sat, 28 Apr 2001 17:47:48 GMT
davidw      01/04/28 10:47:48

  Modified:    .        builddtcl.sh mod_dtcl.c
  Log:
  Added an ErrorScript directive.
  
  Changed some of the cacheing setup dynamics.
  
  Revision  Changes    Path
  1.11      +2 -2      tcl-moddtcl/builddtcl.sh
  
  Index: builddtcl.sh
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/builddtcl.sh,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- builddtcl.sh	2001/03/20 19:26:46	1.10
  +++ builddtcl.sh	2001/04/28 17:47:47	1.11
  @@ -1,5 +1,5 @@
   #!/bin/sh
  -# $Id: builddtcl.sh,v 1.10 2001/03/20 19:26:46 davidw Exp $
  +# $Id: builddtcl.sh,v 1.11 2001/04/28 17:47:47 davidw Exp $
   
   # Name of tclsh - on FreeBSD, this is probably tclsh8.2
   TCLSH=tclsh  ######### CHANGEME ##########
  @@ -34,7 +34,7 @@
       then
       echo "Apache in $APACHE"
       else
  -    echo "Apache NOT in $Apache, please edit builddtcl.sh"
  +    echo "Apache NOT in $APACHE, please edit builddtcl.sh"
       exit 1
   fi
   
  
  
  
  1.25      +27 -13    tcl-moddtcl/mod_dtcl.c
  
  Index: mod_dtcl.c
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/mod_dtcl.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- mod_dtcl.c	2001/03/15 19:36:58	1.24
  +++ mod_dtcl.c	2001/04/28 17:47:47	1.25
  @@ -58,7 +58,7 @@
    * University of Illinois, Urbana-Champaign.
    */
   
  -/* $Id: mod_dtcl.c,v 1.24 2001/03/15 19:36:58 davidw Exp $  */
  +/* $Id: mod_dtcl.c,v 1.25 2001/04/28 17:47:47 davidw Exp $  */
   
   /* mod_dtcl.c by David Welton <davidw@apache.org> - originally mod_include.  */
   /* See http://tcl.apache.org/mod_dtcl/credits.ttml for additional credits. */
  @@ -132,6 +132,7 @@
       Tcl_Obj *dtcl_child_exit_script;
       Tcl_Obj *dtcl_before_script;        /* script run before each page */
       Tcl_Obj *dtcl_after_script;         /*            after            */
  +    Tcl_Obj *dtcl_error_script;         /*            after            */
       int dtcl_cache_size;
       char *server_name; 
   } dtcl_server_conf;
  @@ -636,14 +637,19 @@
   #endif
   
       if (Tcl_EvalObj(interp, outbuf) == TCL_ERROR)
  -    {
  +    {	
   	print_headers(global_rr);
   	flush_output_buffer(global_rr);
  -	errorinfo = Tcl_GetVar(interp, "errorInfo", 0);
  -	print_error(r, 0, errorinfo);
  -	print_error(r, 1, "<p><b>OUTPUT BUFFER:</b></p>");
  -	print_error(r, 0, Tcl_GetStringFromObj(outbuf, (int *)NULL));
  -		    
  +	if (dsc->dtcl_error_script) 
  +	{
  +	    Tcl_EvalObj(interp, dsc->dtcl_error_script);
  +	} else {
  +	    /* default action  */
  +	    errorinfo = Tcl_GetVar(interp, "errorInfo", 0);
  +	    print_error(r, 0, errorinfo);
  +	    print_error(r, 1, "<p><b>OUTPUT BUFFER:</b></p>");
  +	    print_error(r, 0, Tcl_GetStringFromObj(outbuf, (int *)NULL));
  +	}    
   /* 		    "</pre><b>OUTPUT BUFFER</b><pre>\n",
   		    Tcl_GetStringFromObj(outbuf, (int *)NULL));  */
       } else {
  @@ -883,16 +889,20 @@
   			 Tcl_GetVar(interp, "errorInfo", 0));
   	}
       }
  -    if (dsc->dtcl_cache_size != 0)
  +
  +    /* This is what happens if it is not set by the user */
  +    if(dsc->dtcl_cache_size < 0) 
       {
  -	cacheSize = dsc->dtcl_cache_size;
  -	cacheFreeSize = dsc->dtcl_cache_size;
  -    } else {
   	if (ap_max_requests_per_child != 0)
   	    cacheSize = ap_max_requests_per_child / 2;
   	else
   	    cacheSize = 10; /* Arbitrary number FIXME */
   	cacheFreeSize = cacheSize;
  +    } else if (dsc->dtcl_cache_size > 0) {
  +	cacheSize = dsc->dtcl_cache_size;
  +	cacheFreeSize = dsc->dtcl_cache_size;
  +    } else {
  +	cacheSize = 0;
       }
       /* Initializing cache structures */
       objCacheList = malloc(cacheSize * sizeof(char *));
  @@ -950,6 +960,8 @@
   	dsc->dtcl_before_script = objarg;
       } else if (strcmp(arg, "AfterScript") == 0) {
   	dsc->dtcl_after_script = objarg;
  +    } else if (strcmp(arg, "ErrorScript") == 0) {
  +	dsc->dtcl_error_script = objarg;
       } else {
   	return "Mod_Dtcl Error: Dtcl_Script must have a second argument, which is one of: GlobalInitScript,
ChildInitScript, ChildExitScript, BeforeScript, AfterScript";
       }
  @@ -989,7 +1001,8 @@
       dsc->dtcl_child_exit_script = NULL;
       dsc->dtcl_before_script = NULL;
       dsc->dtcl_after_script = NULL;
  -    dsc->dtcl_cache_size = 0;
  +    dsc->dtcl_error_script = NULL;
  +    dsc->dtcl_cache_size = -1;
       dsc->server_name = ap_pstrdup(p, s->server_hostname);
       return dsc;
   }
  @@ -1006,6 +1019,7 @@
       dsc->dtcl_child_exit_script = overrides->dtcl_child_exit_script ? overrides->dtcl_child_exit_script
: base->dtcl_child_exit_script;
       dsc->dtcl_before_script = overrides->dtcl_before_script ? overrides->dtcl_before_script
: base->dtcl_before_script;
       dsc->dtcl_after_script = overrides->dtcl_after_script ? overrides->dtcl_after_script
: base->dtcl_after_script;
  +    dsc->dtcl_error_script = overrides->dtcl_error_script ? overrides->dtcl_error_script
: base->dtcl_error_script;
       dsc->dtcl_cache_size = overrides->dtcl_cache_size ? overrides->dtcl_cache_size
: base->dtcl_cache_size;
       dsc->server_name = overrides->server_name ? overrides->server_name : base->server_name;

       return dsc;
  @@ -1051,7 +1065,7 @@
   
   const command_rec dtcl_cmds[] =
   {
  -    {"Dtcl_Script", set_script, NULL, RSRC_CONF, TAKE2, "Dtcl_Script GlobalInitScript|ChildInitScript|ChildExitScript|BeforeScript|AfterScript
scriptname.tcl"},
  +    {"Dtcl_Script", set_script, NULL, RSRC_CONF, TAKE2, "Dtcl_Script GlobalInitScript|ChildInitScript|ChildExitScript|BeforeScript|AfterScript|ErrorScript
scriptname.tcl"},
       {"Dtcl_CacheSize", set_cachesize, NULL, RSRC_CONF, TAKE1, "Dtcl_Cachesize cachesize"},
       {"Dtcl_UploadDirectory", set_uploaddir, NULL, RSRC_CONF, TAKE1, "Dtcl_UploadDirectory
dirname"},
       {"Dtcl_UploadMaxSize", set_uploadmax, NULL, RSRC_CONF, TAKE1, "Dtcl_UploadMaxSize size"},
  
  
  

Mime
View raw message