ASF Bugzilla – Attachment 32406 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]
3rd patch for ::rivet::abort_page handling
page_abort_handling-3.diff (text/plain), 5.45 KB, created by
Massimo Manghi
on 2015-01-28 15:40:56 UTC
(
hide
)
Description:
3rd patch for ::rivet::abort_page handling
Filename:
MIME Type:
Creator:
Massimo Manghi
Created:
2015-01-28 15:40:56 UTC
Size:
5.45 KB
patch
obsolete
>Index: src/apache-2/mod_rivet.c >=================================================================== >--- src/apache-2/mod_rivet.c (revision 1655232) >+++ src/apache-2/mod_rivet.c (working copy) >@@ -328,16 +328,20 @@ > static int > Rivet_ExecuteAndCheck(Tcl_Interp *interp, Tcl_Obj *tcl_script_obj, request_rec *req) > { >- rivet_server_conf *conf = Rivet_GetConf(req); >- rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL); >+ int result; >+ rivet_server_conf* conf = Rivet_GetConf(req); >+ rivet_interp_globals* globals = Tcl_GetAssocData(interp, "rivet", NULL); > > Tcl_Preserve (interp); >- if ( Tcl_EvalObjEx(interp, tcl_script_obj, 0) == TCL_ERROR ) { >- Tcl_Obj *errscript; >- Tcl_Obj *errorCodeListObj; >- Tcl_Obj *errorCodeElementObj; >- char *errorCodeSubString; >+ result = Tcl_EvalObjEx(interp, tcl_script_obj, 0); > >+ if (result == TCL_ERROR) { >+ >+ Tcl_Obj* errscript; >+ Tcl_Obj* errorCodeListObj; >+ Tcl_Obj* errorCodeElementObj; >+ char* errorCodeSubString; >+ > /* There was an error, see if it's from Rivet and it was caused > * by abort_page. > */ >@@ -376,7 +380,7 @@ > { > CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 ); > TclWeb_PrintError("<b>Rivet AbortScript failed!</b>",1,globals->req); >- TclWeb_PrintError( errorinfo, 0, globals->req ); >+ TclWeb_PrintError(errorinfo,0,globals->req); > } > } > goto good; >@@ -386,7 +390,7 @@ > 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 ) { >+ if (conf->rivet_error_script) { > errscript = conf->rivet_error_script; > } else { > errscript = conf->rivet_default_error_script; >@@ -404,27 +408,13 @@ > Tcl_DecrRefCount(errscript); > } > >- /* Make sure to flush the output if buffer_add was the only output */ > good: > >- if (conf->after_every_script) { >- if (Tcl_EvalObjEx(interp,conf->after_every_script,0) == TCL_ERROR) >- { >- CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 ); >- TclWeb_PrintError("<b>Rivet AfterEveryScript failed!</b>",1,globals->req); >- TclWeb_PrintError( errorinfo, 0, globals->req ); >- } >- } >- >- if (!globals->req->headers_set && (globals->req->charset != NULL)) { >- TclWeb_SetHeaderType (apr_pstrcat(globals->req->req->pool,"text/html;",globals->req->charset,NULL),globals->req); >- } >- > /* Tcl_Flush moved to the end of Rivet_SendContent */ > > Tcl_Release(interp); > >- return TCL_OK; >+ return result; > } > > /* >@@ -605,12 +595,10 @@ > } > > rsc->user_scripts_updated = 0; >- { >- int res = 0; >- res = Rivet_ExecuteAndCheck(interp, outbuf, req->req); >- Tcl_DecrRefCount(outbuf); >- return res; >- } >+ result = Rivet_ExecuteAndCheck(interp, outbuf, req->req); >+ Tcl_DecrRefCount(outbuf); >+ >+ return result; > } > > /* >@@ -629,7 +617,7 @@ > int > Rivet_ParseExecString (TclWebRequest* req, Tcl_Obj* inbuf) > { >- int res = 0; >+ int result; > Tcl_Obj* outbuf = Tcl_NewObj(); > Tcl_Interp *interp = req->interp; > >@@ -644,10 +632,10 @@ > > Tcl_AppendToObj(outbuf, "\n", -1); > >- res = Rivet_ExecuteAndCheck(interp, outbuf, req->req); >+ result = Rivet_ExecuteAndCheck(interp, outbuf, req->req); > Tcl_DecrRefCount(outbuf); > >- return res; >+ return result; > } > > static void >@@ -1494,6 +1482,18 @@ > Tcl_GetVar(interp, "errorInfo", 0)); > } > >+ /* We execute also the AfterEveryScript if one was set */ >+ >+ >+ if (rsc->after_every_script) { >+ if (Rivet_ExecuteAndCheck(interp, rsc->after_every_script,r) == TCL_ERROR) >+ { >+ CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 ); >+ TclWeb_PrintError("<b>Rivet AfterEveryScript failed!</b>",1,globals->req); >+ TclWeb_PrintError( errorinfo, 0, globals->req ); >+ } >+ } >+ > if (request_cleanup == NULL) { > request_cleanup = Tcl_NewStringObj("::Rivet::cleanup_request\n", -1); > Tcl_IncrRefCount(request_cleanup); >@@ -1506,11 +1506,20 @@ > } > > /* Reset globals */ >- Rivet_CleanupRequest( r ); >+ Rivet_CleanupRequest(r); > > retval = OK; > sendcleanup: > >+ /* Let's set the charset in the headers if one was set in the configuration */ >+ >+ if (!globals->req->headers_set && (globals->req->charset != NULL)) { >+ TclWeb_SetHeaderType (apr_pstrcat(globals->req->req->pool,"text/html;", >+ globals->req->charset,NULL), >+ globals->req); >+ } >+ >+ > /* Everything is done and we flush the rivet channel before resetting the status */ > > TclWeb_PrintHeaders(globals->req); >Index: src/rivetcmds/rivetCore.c >=================================================================== >--- src/rivetcmds/rivetCore.c (revision 1655232) >+++ src/rivetcmds/rivetCore.c (working copy) >@@ -241,11 +241,7 @@ > return TCL_ERROR; > } > >- if (Rivet_ParseExecFile(globals->req, filename, 0) == TCL_OK) { >- return TCL_OK; >- } else { >- return TCL_ERROR; >- } >+ return Rivet_ParseExecFile(globals->req, filename, 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