rem: status = NS_OK;
add: status = Ns_ConnClose(conn);
context: Ns_AdpRequest(Ns_Conn *conn, char *file){    Conn	     *connPtr = (Conn *) conn;    Tcl_Interp       *interp;    NsInterp          *itPtr;    int               status, len;    char             *type, *charset, *start, *argv[1], *out;    Ns_Set           *setPtr;    NsServer	     *servPtr;    Tcl_Encoding      encoding;    Tcl_DString	      ds;        /*     * Get the current connection's interp.     */    interp = Ns_GetConnInterp(conn);    itPtr = NsGetInterp(interp);    servPtr = itPtr->servPtr;    Tcl_DStringInit(&ds);    /*     * Set the old conn variable for backwards compatibility.     */    Tcl_SetVar2(interp, "conn", NULL, connPtr->idstr, TCL_GLOBAL_ONLY);    Tcl_ResetResult(interp);    itPtr->adp.stream = 0;    if (servPtr->adp.enabledebug &&	STREQ(conn->request->method, "GET") &&	(setPtr = Ns_ConnGetQuery(conn)) != NULL) {	itPtr->adp.debugFile = Ns_SetIGet(setPtr, "debug");    }    type = Ns_GetMimeType(file);    if (type == NULL || (strcmp(type, "*/*") == 0)) {        type = "text/html";    }    NsAdpSetMimeType(itPtr, type);    if (servPtr->adp.enableexpire) {	Ns_ConnCondSetHeaders(conn, "Expires", "now");    }    /*     * Include the ADP with the special start page and null args.     */    start = servPtr->adp.startpage ? servPtr->adp.startpage : file;    argv[0] = NULL;    if (NsAdpInclude(itPtr, start, 0, argv) != TCL_OK) {	Ns_TclLogError(interp);    }    /*     * Deal with any possible exceptions.     */    switch (itPtr->adp.exception) {	case ADP_ABORT:	    /*	     * Abort is normally used after a call to a	     * ns_return function so no response is sent here.	     */	    status = NS_OK;	    break;	case ADP_OVERFLOW:	    Ns_Log(Error, "adp: stack overflow: '%s'", file);	    status = Ns_ConnReturnInternalError(conn);	    break;	default:	    if (Ns_ConnResponseStatus(conn) != 0) {		/*		 * A response has already been sent, either because the		 * connection was set in streaming mode or an ns_return		 * command was called.		 */                status = NS_OK;	    } else {		/*		 * Encode the output buffer from UTF to the requested		 * charset.		 */		out = connPtr->content.string;		len = connPtr->content.length;		type = itPtr->adp.mimetype;		charset = itPtr->adp.charset;		if (charset == NULL) {		    charset = strstr(type, "charset=");		    if (charset != NULL) {			charset += 8;		    }		}		if (charset != NULL) {		    encoding = Ns_GetEncoding(charset);		    if (encoding != NULL) {			Tcl_UtfToExternalDString(encoding, out, len, &ds);			out = ds.string;			len = ds.length;		    }		}		/*		 * Flush out the headers and content.		 */		status = Ns_ConnReturnData(conn, 200, out, len, type);            }	    break;    }    /*     * Cleanup the per-thead ADP context.     */    itPtr->adp.outputPtr = NULL;    itPtr->adp.exception = ADP_OK;    itPtr->adp.depth = 0;    itPtr->adp.argc = 0;    itPtr->adp.argv = NULL;    itPtr->adp.cwd = NULL;    itPtr->adp.file = NULL;    itPtr->adp.debugLevel = 0;    itPtr->adp.debugInit = 0;    itPtr->adp.debugFile = NULL;    NsAdpSetMimeType(itPtr, NULL);    NsAdpSetCharSet(itPtr, NULL);    Tcl_DStringFree(&ds);    return status;}