Here is a test patch for the ns_adp_abort issue.

The patch enables sending an error message in the case of an actual
error during adp processing, or after a postauth filter (preauth errors
already allow this behavior). 

Also, logging is enabled in all cases. If an error occurs, a 500
response is sent and this is what is logged. 

I haven't tested this with ns_adp_break. But it works with ns_adp_return
and ns_adp_abort as well as error handling in and adp. 

tom jackson

Not sure if I can attach the patch, but here goes:




--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<[email protected]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.
t...@boron:~/cvs/aolserver/aolserver/nsd$ diff -u adpeval.c /web/tnt/aolserver/aolserver/nsd/adpeval.c
--- adpeval.c	2008-06-10 17:23:02.000000000 -0700
+++ /web/tnt/aolserver/aolserver/nsd/adpeval.c	2009-04-04 09:16:35.000000000 -0700
@@ -1017,7 +1017,11 @@
 	break;
     case ADP_RETURN:
 	itPtr->adp.exception = ADP_OK;
-	/* FALLTHROUGH */
+	result = TCL_OK;
+	break;
+    case ADP_ABORT:
+        result = TCL_ERROR;
+        break;
     default: 
 	result = TCL_OK;
 	break;
t...@boron:~/cvs/aolserver/aolserver/nsd$ diff -u adprequest.c /web/tnt/aolserver/aolserver/nsd/adprequest.c
--- adprequest.c	2008-06-10 17:23:02.000000000 -0700
+++ /web/tnt/aolserver/aolserver/nsd/adprequest.c	2009-04-04 09:33:00.000000000 -0700
@@ -154,9 +154,15 @@
     result = NsAdpInclude(itPtr, 2, objv, start, ttlPtr);
     Tcl_DecrRefCount(objv[0]);
     Tcl_DecrRefCount(objv[1]);
-    if (NsAdpFlush(itPtr, 0) != TCL_OK || result != TCL_OK) {
-	return NS_ERROR;
+    if ((result != TCL_OK) && (itPtr->adp.exception == ADP_OK)) {
+	  itPtr->adp.exception = ADP_ABORT;
+	  NsAdpFlush(itPtr, 0);
+	  return NS_ERROR;
     }
+    if (NsAdpFlush(itPtr, 0) != TCL_OK) {
+      return NS_ERROR;
+    }
+    
     return NS_OK;
 }
 
@@ -216,6 +222,7 @@
     Tcl_ResetResult(interp);
     if (itPtr->adp.exception == ADP_ABORT) {
 	Tcl_SetResult(interp, "adp flush disabled: adp aborted", TCL_STATIC);
+	result = TCL_OK;
     } else if (len == 0 && stream) {
 	result = TCL_OK;
     } else {
t...@boron:~/cvs/aolserver/aolserver/nsd$ diff -u queue.c /web/tnt/aolserver/aolserver/nsd/queue.c
--- queue.c	2009-04-04 08:43:56.000000000 -0700
+++ /web/tnt/aolserver/aolserver/nsd/queue.c	2009-04-03 16:17:46.000000000 -0700
@@ -595,6 +595,13 @@
 		status = NsRunFilters(conn, NS_FILTER_POST_AUTH);
 		if (status == NS_OK) {
 		    status = Ns_ConnRunRequest(conn);
+		    if (status != NS_OK) {
+		        Ns_ConnReturnInternalError(conn);
+			status = NS_OK; /* to allow tracing to happen */
+		    }
+		} else {
+		    Ns_ConnReturnInternalError(conn);
+		    status = NS_FILTER_RETURN; /* to allow tracing to happen */
 		}
 		break;
 

Reply via email to