ASF Bugzilla – Attachment 32659 Details for
Bug 57501
abort_page does not stop page execution after a call to ::rivet::parse
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
extended error handling
script_error_handling.diff (text/plain), 5.57 KB, created by
Massimo Manghi
on 2015-04-18 17:16:57 UTC
(
hide
)
Description:
extended error handling
Filename:
MIME Type:
Creator:
Massimo Manghi
Created:
2015-04-18 17:16:57 UTC
Size:
5.57 KB
patch
obsolete
>Index: src/apache-2/mod_rivet.c >=================================================================== >--- src/apache-2/mod_rivet.c (revision 1665838) >+++ src/apache-2/mod_rivet.c (working copy) >@@ -299,6 +299,51 @@ > } > } > >+/* -- Rivet_ExecuteErrorHandler >+ * >+ * >+ * >+ */ >+ >+static int >+Rivet_ExecuteErrorHandler (Tcl_Interp* interp,Tcl_Obj* tcl_script_obj, request_rec* req) >+{ >+ int result; >+ rivet_server_conf* conf = Rivet_GetConf(req); >+ Tcl_Obj* errscript; >+ >+ /* We extract information from the errorOutbuf variable. Notice that tcl_script_obj >+ * can either be the request processing script or conf->rivet_abort_script >+ */ >+ >+ Tcl_SetVar( interp, "errorOutbuf",Tcl_GetStringFromObj( tcl_script_obj, NULL ),TCL_GLOBAL_ONLY ); >+ >+ /* If we don't have an error script, use the default error handler. */ >+ if (conf->rivet_error_script) { >+ errscript = conf->rivet_error_script; >+ } else { >+ errscript = conf->rivet_default_error_script; >+ } >+ >+ Tcl_IncrRefCount(errscript); >+ result = Tcl_EvalObjEx(interp, errscript, 0); >+ if (result == TCL_ERROR) { >+ rivet_interp_globals* globals = Tcl_GetAssocData(interp, "rivet", NULL); >+ CONST84 char* errorinfo = Tcl_GetVar( interp, "errorInfo", 0 ); >+ >+ TclWeb_PrintError("<b>Rivet ErrorScript failed!</b>",1,globals->req); >+ TclWeb_PrintError( errorinfo, 0, globals->req ); >+ } >+ >+ /* This shouldn't make the default_error_script go away, >+ * because it gets a Tcl_IncrRefCount when it is created. >+ */ >+ Tcl_DecrRefCount(errscript); >+ >+ return result; >+} >+ >+ > /* -- Rivet_ExecuteAndCheck > * > * Tcl script execution central procedure. The script stored >@@ -316,7 +361,8 @@ > * > * Returned value: > * >- * - invariably TCL_OK >+ * - One of the Tcl defined returned value of Tcl_EvelObjExe (TCL_OK, >+ * TCL_ERROR, TCL_BREAK etc.) > * > * Side effects: > * >@@ -330,7 +376,6 @@ > { > int result; > rivet_server_conf* conf = Rivet_GetConf(req); >- rivet_interp_globals* globals = Tcl_GetAssocData(interp, "rivet", NULL); > > Tcl_Preserve (interp); > result = Tcl_EvalObjEx(interp, tcl_script_obj, 0); >@@ -337,7 +382,6 @@ > > if (result == TCL_ERROR) { > >- Tcl_Obj* errscript; > Tcl_Obj* errorCodeListObj; > Tcl_Obj* errorCodeElementObj; > char* errorCodeSubString; >@@ -376,39 +420,35 @@ > { > if (conf->rivet_abort_script) > { >- if (Tcl_EvalObjEx(interp,conf->rivet_abort_script,0) == TCL_ERROR) >+ >+ /* Ideally an AbortScript should be fail safe, but in case >+ * it fails we give a chance to the subsequent ErrorScript >+ * to catch this error. >+ */ >+ >+ result = Tcl_EvalObjEx(interp,conf->rivet_abort_script,0); >+ if (result == TCL_ERROR) > { >- CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 ); >- TclWeb_PrintError("<b>Rivet AbortScript failed!</b>",1,globals->req); >- TclWeb_PrintError(errorinfo,0,globals->req); >+ //CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 ); >+ //TclWeb_PrintError("<b>Rivet AbortScript failed!</b>",1,globals->req); >+ //TclWeb_PrintError(errorinfo,0,globals->req); >+ >+ result = Rivet_ExecuteErrorHandler(interp,conf->rivet_abort_script,req); >+ > } > } >- goto good; > } > } >+ else >+ { >+ /* Invoke Tcl error handler */ > >- Tcl_SetVar( interp, "errorOutbuf",Tcl_GetStringFromObj( tcl_script_obj, NULL ),TCL_GLOBAL_ONLY ); >+ result = Rivet_ExecuteErrorHandler(interp,tcl_script_obj,req); > >- /* If we don't have an error script, use the default error handler. */ >- if (conf->rivet_error_script) { >- errscript = conf->rivet_error_script; >- } else { >- errscript = conf->rivet_default_error_script; > } > >- Tcl_IncrRefCount(errscript); >- if (Tcl_EvalObjEx(interp, errscript, 0) == TCL_ERROR) { >- CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 ); >- TclWeb_PrintError("<b>Rivet ErrorScript failed!</b>",1,globals->req); >- TclWeb_PrintError( errorinfo, 0, globals->req ); >- } > >- /* This shouldn't make the default_error_script go away, >- * because it gets a Tcl_IncrRefCount when it is created. */ >- Tcl_DecrRefCount(errscript); > } >- >-good: > > /* Tcl_Flush moved to the end of Rivet_SendContent */ > >@@ -425,7 +465,12 @@ > * if a Tcl script. > * > * This is a separate function so that it may be called from command 'parse' >+ * >+ * Returned value: > * >+ * - One of the Tcl defined values returned by Rivet_ExecuteAndCheck (TCL_OK, >+ * TCL_ERROR, TCL_BREAK etc.) >+ * > * Arguments: > * > * - TclWebRequest: pointer to the structure collecting Tcl and Apache data >@@ -1477,7 +1522,7 @@ > if (Rivet_ParseExecFile(globals->req, r->filename, 1) != TCL_OK) > { > ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, r->server, >- MODNAME ": Error parsing exec file '%s': %s", >+ MODNAME ": Error in Rivet_ParseExecFile exec file '%s': %s", > r->filename, > Tcl_GetVar(interp, "errorInfo", 0)); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 57501
:
32403
|
32404
|
32406
|
32659
|
32672
|
32688
|
32709
|
32713