I just noticed that mod_dtcl checks for errors (and prints
the error buffer to HTML) only when parsing
inline scripts. Since we use standalone Tcl scripts, I've
moved the code block that performs the execution and
the check (if result == TCL_ERROR then blabla...) in
a function called execute_and_check().

Here are the patches for mod_dtcl.c and mod_dtcl.h,
against mod_dtcl 0.11.0.

Regards,

-- 
Valerio Gionco   [[EMAIL PROTECTED]]
MOST s.r.l.      Via Bezzecca, 9 - 10131 Torino 
************************************************************************
            "Life's not fair, but the root password helps."


-----------------diff mod_dtcl.h mod_dtcl_patched.h ------------------------------
59a60
> int execute_and_check(Tcl_Interp *interp, Tcl_Obj *outbuf, request_rec *r);
66d66
<
-----------------diff  mod_dtcl.c mod_dtcl_patched.c------------------------------
428c428
<       Tcl_EvalObj(interp, (cmdObjPtr));
---
>       execute_and_check(interp, (cmdObjPtr), r);
430c430
<       Tcl_EvalObj(interp, (Tcl_Obj *)Tcl_GetHashValue(entry));
---
>       execute_and_check(interp, (cmdObjPtr), r);
641a642,652
>     return(execute_and_check(interp, outbuf, r));
> }
>
> /* Calls Tcl_EvalObj() and checks for errors; prints the error buffer if any. */
> int execute_and_check(Tcl_Interp *interp, Tcl_Obj *outbuf, request_rec *r)
> {
>  char *errorinfo;
>  dtcl_server_conf *dsc = NULL;
>
>  dsc = (dtcl_server_conf *) ap_get_module_config(r->server->module_config, &dtcl_module);
>
643,658c654,669
<     {
<       print_headers(global_rr);
<       flush_output_buffer(global_rr);
<       if (dsc->dtcl_error_script)
<       {
<           if (Tcl_EvalObj(interp, dsc->dtcl_error_script) == TCL_ERROR)
<               print_error(r, 1, "<b>Tcl_ErrorScript failed!</b>");
<       } 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));  */
---
>     {
>         print_headers(global_rr);
>         flush_output_buffer(global_rr);
>         if (dsc->dtcl_error_script)
>         {
>              if (Tcl_EvalObj(interp, dsc->dtcl_error_script) == TCL_ERROR)
>                 print_error(r, 1, "<b>Tcl_ErrorScript failed!</b>");
>         } 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));  */
660,662c671,673
<       /* We make sure to flush the output if buffer_add was the only output */
<       print_headers(global_rr);
<       flush_output_buffer(global_rr);
---
>         /* We make sure to flush the output if buffer_add was the only output */
>         print_headers(global_rr);
>         flush_output_buffer(global_rr);
665a677,678
>
>

Reply via email to