From: Stephen D. <sd...@us...> - 2005-10-02 17:39:01
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6858/nsd Modified Files: op.c adprequest.c return.c urlspace.c Log Message: * nsd/adprequest.c: * nsd/op.c: * nsd/return.c: * nsd/urlspace: Untabify and reformat. Index: op.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/op.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** op.c 10 Jun 2005 17:58:39 -0000 1.3 --- op.c 2 Oct 2005 05:27:44 -0000 1.4 *************** *** 31,36 **** * op.c -- * ! * Routines to register, unregister, and run connection request ! * routines (previously known as "op procs"). */ --- 31,36 ---- * op.c -- * ! * Routines to register, unregister, and run connection request ! * routines (previously known as "op procs"). */ *************** *** 45,49 **** typedef struct { ! int refcnt; Ns_OpProc *proc; Ns_Callback *delete; --- 45,49 ---- typedef struct { ! int refcnt; Ns_OpProc *proc; Ns_Callback *delete; *************** *** 62,66 **** */ ! static Ns_Mutex ulock; static int uid; --- 62,66 ---- */ ! static Ns_Mutex ulock; static int uid; *************** *** 71,81 **** * NsInitRequests -- * ! * Initialize the request API. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 71,81 ---- * NsInitRequests -- * ! * Initialize the request API. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 96,108 **** * Ns_RegisterRequest -- * ! * Register a new procedure to be called to service matching ! * given method and url pattern. * * Results: ! * None. * * Side effects: ! * Delete procedure of previously registered request, if any, ! * will be called unless NS_OP_NODELETE flag is set. * *---------------------------------------------------------------------- --- 96,108 ---- * Ns_RegisterRequest -- * ! * Register a new procedure to be called to service matching ! * given method and url pattern. * * Results: ! * None. * * Side effects: ! * Delete procedure of previously registered request, if any, ! * will be called unless NS_OP_NODELETE flag is set. * *---------------------------------------------------------------------- *************** *** 111,115 **** void Ns_RegisterRequest(char *server, char *method, char *url, Ns_OpProc *proc, ! Ns_Callback *delete, void *arg, int flags) { Req *reqPtr; --- 111,115 ---- void Ns_RegisterRequest(char *server, char *method, char *url, Ns_OpProc *proc, ! Ns_Callback *delete, void *arg, int flags) { Req *reqPtr; *************** *** 132,143 **** * Ns_GetRequest -- * ! * Return the procedures and context for a given method and url ! * pattern. * * Results: ! * None. * * Side effects: ! * * *---------------------------------------------------------------------- --- 132,143 ---- * Ns_GetRequest -- * ! * Return the procedures and context for a given method and url ! * pattern. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 146,150 **** void Ns_GetRequest(char *server, char *method, char *url, Ns_OpProc **procPtr, ! Ns_Callback **deletePtr, void **argPtr, int *flagsPtr) { Req *reqPtr; --- 146,150 ---- void Ns_GetRequest(char *server, char *method, char *url, Ns_OpProc **procPtr, ! Ns_Callback **deletePtr, void **argPtr, int *flagsPtr) { Req *reqPtr; *************** *** 158,165 **** *flagsPtr = reqPtr->flags; } else { ! *procPtr = NULL; ! *deletePtr = NULL; ! *argPtr = NULL; ! *flagsPtr = 0; } Ns_MutexUnlock(&ulock); --- 158,165 ---- *flagsPtr = reqPtr->flags; } else { ! *procPtr = NULL; ! *deletePtr = NULL; ! *argPtr = NULL; ! *flagsPtr = 0; } Ns_MutexUnlock(&ulock); *************** *** 172,183 **** * Ns_UnRegisterRequest -- * ! * Remove the procedure which would run for the given method and ! * url pattern. * * Results: ! * None. * * Side effects: ! * Requests deleteProc may run. * *---------------------------------------------------------------------- --- 172,183 ---- * Ns_UnRegisterRequest -- * ! * Remove the procedure which would run for the given method and ! * url pattern. * * Results: ! * None. * * Side effects: ! * Requests deleteProc may run. * *---------------------------------------------------------------------- *************** *** 189,193 **** Ns_MutexLock(&ulock); Ns_UrlSpecificDestroy(server, method, url, uid, ! inherit ? 0 : NS_OP_NOINHERIT); Ns_MutexUnlock(&ulock); } --- 189,193 ---- Ns_MutexLock(&ulock); Ns_UrlSpecificDestroy(server, method, url, uid, ! inherit ? 0 : NS_OP_NOINHERIT); Ns_MutexUnlock(&ulock); } *************** *** 199,210 **** * Ns_ConnRunRequest -- * ! * Locate and execute the procedure for the given method and ! * url pattern. * * Results: ! * Standard request procedure result, normally NS_OK. * * Side effects: ! * Depends on request procedure. * *---------------------------------------------------------------------- --- 199,210 ---- * Ns_ConnRunRequest -- * ! * Locate and execute the procedure for the given method and ! * url pattern. * * Results: ! * Standard request procedure result, normally NS_OK. * * Side effects: ! * Depends on request procedure. * *---------------------------------------------------------------------- *************** *** 220,231 **** Ns_MutexLock(&ulock); reqPtr = Ns_UrlSpecificGet(server, conn->request->method, ! conn->request->url, uid); if (reqPtr == NULL) { ! Ns_MutexUnlock(&ulock); ! if (STREQ(conn->request->method, "BAD")) { ! return Ns_ConnReturnBadRequest(conn, NULL); ! } else { ! return Ns_ConnReturnNotFound(conn); ! } } ++reqPtr->refcnt; --- 220,231 ---- Ns_MutexLock(&ulock); reqPtr = Ns_UrlSpecificGet(server, conn->request->method, ! conn->request->url, uid); if (reqPtr == NULL) { ! Ns_MutexUnlock(&ulock); ! if (STREQ(conn->request->method, "BAD")) { ! return Ns_ConnReturnBadRequest(conn, NULL); ! } else { ! return Ns_ConnReturnNotFound(conn); ! } } ++reqPtr->refcnt; *************** *** 235,238 **** --- 235,239 ---- FreeReq(reqPtr); Ns_MutexUnlock(&ulock); + return status; } *************** *** 244,258 **** * Ns_ConnRedirect -- * ! * Perform an internal redirect by updating the connection's ! * request URL and re-authorizing and running the request. This ! * Routine is used in FastPath to redirect to directory files ! * (e.g., index.html) and in return.c to redirect by HTTP result ! * code (e.g., custom not-found handler). * * Results: ! * Standard request procedure result, normally NS_OK. * * Side effects: ! * Depends on request procedure. * *---------------------------------------------------------------------- --- 245,259 ---- * Ns_ConnRedirect -- * ! * Perform an internal redirect by updating the connection's ! * request URL and re-authorizing and running the request. This ! * Routine is used in FastPath to redirect to directory files ! * (e.g., index.html) and in return.c to redirect by HTTP result ! * code (e.g., custom not-found handler). * * Results: ! * Standard request procedure result, normally NS_OK. * * Side effects: ! * Depends on request procedure. * *---------------------------------------------------------------------- *************** *** 275,280 **** status = Ns_AuthorizeRequest(Ns_ConnServer(conn), conn->request->method, ! conn->request->url, conn->authUser, ! conn->authPasswd, Ns_ConnPeer(conn)); switch (status) { case NS_OK: --- 276,281 ---- status = Ns_AuthorizeRequest(Ns_ConnServer(conn), conn->request->method, ! conn->request->url, conn->authUser, ! conn->authPasswd, Ns_ConnPeer(conn)); switch (status) { case NS_OK: *************** *** 302,313 **** * Ns_RegisterProxyRequest -- * ! * Register a new procedure to be called to proxy matching ! * given method and protocol pattern. * * Results: ! * None. * * Side effects: ! * Delete procedure of previously registered request, if any. * *---------------------------------------------------------------------- --- 303,314 ---- * Ns_RegisterProxyRequest -- * ! * Register a new procedure to be called to proxy matching ! * given method and protocol pattern. * * Results: ! * None. * * Side effects: ! * Delete procedure of previously registered request, if any. * *---------------------------------------------------------------------- *************** *** 316,331 **** void Ns_RegisterProxyRequest(char *server, char *method, char *protocol, ! Ns_OpProc *proc, Ns_Callback *delete, void *arg) { ! NsServer *servPtr; ! Req *reqPtr; ! Ns_DString ds; ! int new; Tcl_HashEntry *hPtr; servPtr = NsGetServer(server); if (servPtr == NULL) { ! Ns_Log(Error, "Ns_RegisterProxyRequest: no such server: %s", server); ! return; } Ns_DStringInit(&ds); --- 317,332 ---- void Ns_RegisterProxyRequest(char *server, char *method, char *protocol, ! Ns_OpProc *proc, Ns_Callback *delete, void *arg) { ! NsServer *servPtr; ! Req *reqPtr; ! Ns_DString ds; ! int new; Tcl_HashEntry *hPtr; servPtr = NsGetServer(server); if (servPtr == NULL) { ! Ns_Log(Error, "Ns_RegisterProxyRequest: no such server: %s", server); ! return; } Ns_DStringInit(&ds); *************** *** 340,344 **** hPtr = Tcl_CreateHashEntry(&servPtr->request.proxy, ds.string, &new); if (!new) { ! FreeReq(Tcl_GetHashValue(hPtr)); } Tcl_SetHashValue(hPtr, reqPtr); --- 341,345 ---- hPtr = Tcl_CreateHashEntry(&servPtr->request.proxy, ds.string, &new); if (!new) { ! FreeReq(Tcl_GetHashValue(hPtr)); } Tcl_SetHashValue(hPtr, reqPtr); *************** *** 353,364 **** * Ns_UnRegisterProxyRequest -- * ! * Remove the procedure which would run for the given method and ! * protocol. * * Results: ! * None. * * Side effects: ! * Request's deleteProc may run. * *---------------------------------------------------------------------- --- 354,365 ---- * Ns_UnRegisterProxyRequest -- * ! * Remove the procedure which would run for the given method and ! * protocol. * * Results: ! * None. * * Side effects: ! * Request's deleteProc may run. * *---------------------------------------------------------------------- *************** *** 368,387 **** Ns_UnRegisterProxyRequest(char *server, char *method, char *protocol) { ! NsServer *servPtr; ! Ns_DString ds; Tcl_HashEntry *hPtr; servPtr = NsGetServer(server); if (servPtr != NULL) { ! Ns_DStringInit(&ds); ! Ns_DStringVarAppend(&ds, method, protocol, NULL); ! Ns_MutexLock(&servPtr->request.plock); ! hPtr = Tcl_FindHashEntry(&servPtr->request.proxy, ds.string); ! if (hPtr != NULL) { ! FreeReq(Tcl_GetHashValue(hPtr)); ! Tcl_DeleteHashEntry(hPtr); ! } ! Ns_MutexUnlock(&servPtr->request.plock); ! Ns_DStringFree(&ds); } } --- 369,388 ---- Ns_UnRegisterProxyRequest(char *server, char *method, char *protocol) { ! NsServer *servPtr; ! Ns_DString ds; Tcl_HashEntry *hPtr; servPtr = NsGetServer(server); if (servPtr != NULL) { ! Ns_DStringInit(&ds); ! Ns_DStringVarAppend(&ds, method, protocol, NULL); ! Ns_MutexLock(&servPtr->request.plock); ! hPtr = Tcl_FindHashEntry(&servPtr->request.proxy, ds.string); ! if (hPtr != NULL) { ! FreeReq(Tcl_GetHashValue(hPtr)); ! Tcl_DeleteHashEntry(hPtr); ! } ! Ns_MutexUnlock(&servPtr->request.plock); ! Ns_DStringFree(&ds); } } *************** *** 393,404 **** * NsConnRunProxyRequest -- * ! * Locate and execute the procedure for the given method and ! * protocol pattern. * * Results: ! * Standard request procedure result, normally NS_OK. * * Side effects: ! * Depends on request procedure. * *---------------------------------------------------------------------- --- 394,405 ---- * NsConnRunProxyRequest -- * ! * Locate and execute the procedure for the given method and ! * protocol pattern. * * Results: ! * Standard request procedure result, normally NS_OK. * * Side effects: ! * Depends on request procedure. * *---------------------------------------------------------------------- *************** *** 408,417 **** NsConnRunProxyRequest(Ns_Conn *conn) { ! Conn *connPtr = (Conn *) conn; ! NsServer *servPtr = connPtr->servPtr; Ns_Request *request = conn->request; ! Req *reqPtr = NULL; ! int status; ! Ns_DString ds; Tcl_HashEntry *hPtr; --- 409,418 ---- NsConnRunProxyRequest(Ns_Conn *conn) { ! Conn *connPtr = (Conn *) conn; ! NsServer *servPtr = connPtr->servPtr; Ns_Request *request = conn->request; ! Req *reqPtr = NULL; ! int status; ! Ns_DString ds; Tcl_HashEntry *hPtr; *************** *** 421,437 **** hPtr = Tcl_FindHashEntry(&servPtr->request.proxy, ds.string); if (hPtr != NULL) { ! reqPtr = Tcl_GetHashValue(hPtr); ! ++reqPtr->refcnt; } Ns_MutexUnlock(&servPtr->request.plock); if (reqPtr == NULL) { ! status = Ns_ConnReturnNotFound(conn); } else { ! status = (*reqPtr->proc) (reqPtr->arg, conn); ! Ns_MutexLock(&servPtr->request.plock); ! FreeReq(reqPtr); ! Ns_MutexUnlock(&servPtr->request.plock); } Ns_DStringFree(&ds); return status; } --- 422,439 ---- hPtr = Tcl_FindHashEntry(&servPtr->request.proxy, ds.string); if (hPtr != NULL) { ! reqPtr = Tcl_GetHashValue(hPtr); ! ++reqPtr->refcnt; } Ns_MutexUnlock(&servPtr->request.plock); if (reqPtr == NULL) { ! status = Ns_ConnReturnNotFound(conn); } else { ! status = (*reqPtr->proc) (reqPtr->arg, conn); ! Ns_MutexLock(&servPtr->request.plock); ! FreeReq(reqPtr); ! Ns_MutexUnlock(&servPtr->request.plock); } Ns_DStringFree(&ds); + return status; } *************** *** 443,453 **** * FreeReq -- * ! * URL space callback to delete a request structure. * * Results: ! * None. * * Side effects: ! * Depends on request delete procedure. * *---------------------------------------------------------------------- --- 445,455 ---- * FreeReq -- * ! * URL space callback to delete a request structure. * * Results: ! * None. * * Side effects: ! * Depends on request delete procedure. * *---------------------------------------------------------------------- *************** *** 460,465 **** if (--reqPtr->refcnt == 0) { ! if (reqPtr->delete != NULL) { ! (*reqPtr->delete) (reqPtr->arg); } ns_free(reqPtr); --- 462,467 ---- if (--reqPtr->refcnt == 0) { ! if (reqPtr->delete != NULL) { ! (*reqPtr->delete) (reqPtr->arg); } ns_free(reqPtr); *************** *** 496,506 **** * NsGetRequestProcs -- * ! * Returns information about registered requests/procs * * Results: ! * DString with info as Tcl list * * Side effects: ! * None * *---------------------------------------------------------------------- --- 498,508 ---- * NsGetRequestProcs -- * ! * Returns information about registered requests/procs. * * Results: ! * DString with info as Tcl list. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 516,523 **** return; } - Ns_MutexLock(&ulock); NsUrlSpecificWalk(uid, servPtr->server, NsTclRequestArgProc, dsPtr); Ns_MutexUnlock(&ulock); } - --- 518,523 ---- Index: return.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/return.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** return.c 1 Aug 2005 16:22:25 -0000 1.14 --- return.c 2 Oct 2005 05:27:44 -0000 1.15 *************** *** 32,36 **** * return.c -- * ! * Functions that return data to a browser. */ --- 32,36 ---- * return.c -- * ! * Functions that return data to a browser. */ [...1574 lines suppressed...] *** 1338,1346 **** Ns_ConnQueueHeaders(conn, status); if (chan != NULL) { ! result = Ns_ConnSendChannel(conn, chan, len); } else if (fp != NULL) { ! result = Ns_ConnSendFp(conn, fp, len); } else { ! result = Ns_ConnSendFd(conn, fd, len); } if (result == NS_OK) { --- 1351,1359 ---- Ns_ConnQueueHeaders(conn, status); if (chan != NULL) { ! result = Ns_ConnSendChannel(conn, chan, len); } else if (fp != NULL) { ! result = Ns_ConnSendFp(conn, fp, len); } else { ! result = Ns_ConnSendFd(conn, fd, len); } if (result == NS_OK) { Index: urlspace.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/urlspace.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** urlspace.c 11 Jun 2005 20:00:48 -0000 1.4 --- urlspace.c 2 Oct 2005 05:27:44 -0000 1.5 *************** *** 32,40 **** * urlspace.c -- * ! * This file implements a Trie data structure. It is used ! * for "UrlSpecificData"; for example, when one registers ! * a handler for all GET /foo/bar/ *.html requests, the data ! * structure that holds that information is implemented herein. ! * For full details see the file doc/urlspace.txt. */ --- 32,40 ---- [...2655 lines suppressed...] for (depth = 0; stack[depth] != NULL; depth++) { switch (depth) { ! case 0: ! Tcl_DStringAppendElement(dsPtr, stack[depth]); ! break; ! case 1: ! Tcl_DStringAppendElement(dsPtr, stack[depth]); ! Tcl_DStringAppend(dsPtr, " ", 1); ! break; ! default: ! Ns_DStringVarAppend(dsPtr, "/", stack[depth], NULL); ! break; } } *************** *** 2198,2200 **** Ns_MutexUnlock(&lock); } - --- 2177,2178 ---- Index: adprequest.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/adprequest.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** adprequest.c 1 Aug 2005 16:22:25 -0000 1.5 --- adprequest.c 2 Oct 2005 05:27:44 -0000 1.6 *************** *** 31,35 **** * adprequest.c -- * ! * ADP connection request support. */ --- 31,35 ---- * adprequest.c -- * ! * ADP connection request support. */ *************** *** 77,87 **** * Ns_AdpRequest - * ! * Invoke a file for an ADP request. * * Results: ! * A standard AOLserver request result. * * Side effects: ! * Depends on code embedded within page. * *---------------------------------------------------------------------- --- 77,87 ---- * Ns_AdpRequest - * ! * Invoke a file for an ADP request. * * Results: ! * A standard AOLserver request result. * * Side effects: ! * Depends on code embedded within page. * *---------------------------------------------------------------------- *************** *** 91,103 **** Ns_AdpRequest(Ns_Conn *conn, char *file) { ! Conn *connPtr = (Conn *) conn; Tcl_Interp *interp; ! Tcl_DString rds, tds; ! NsInterp *itPtr; int status; char *type, *start; Ns_Set *setPtr; ! NsServer *servPtr; ! Tcl_Obj *objv[2]; /* --- 91,103 ---- Ns_AdpRequest(Ns_Conn *conn, char *file) { ! Conn *connPtr = (Conn *) conn; Tcl_Interp *interp; ! Tcl_DString rds, tds; ! NsInterp *itPtr; int status; char *type, *start; Ns_Set *setPtr; ! NsServer *servPtr; ! Tcl_Obj *objv[2]; /* *************** *** 106,110 **** if (access(file, R_OK) != 0) { ! return Ns_ConnReturnNotFound(conn); } --- 106,110 ---- if (access(file, R_OK) != 0) { ! return Ns_ConnReturnNotFound(conn); } *************** *** 149,156 **** */ ! if (servPtr->adp.enabledebug && ! STREQ(conn->request->method, "GET") && ! (setPtr = Ns_ConnGetQuery(conn)) != NULL) { ! itPtr->adp.debugFile = Ns_SetIGet(setPtr, "debug"); } --- 149,156 ---- */ ! if (servPtr->adp.enabledebug ! && STREQ(conn->request->method, "GET") ! && (setPtr = Ns_ConnGetQuery(conn)) != NULL) { ! itPtr->adp.debugFile = Ns_SetIGet(setPtr, "debug"); } *************** *** 164,172 **** Tcl_IncrRefCount(objv[0]); Tcl_IncrRefCount(objv[1]); ! if (NsAdpInclude(itPtr, start, 2, objv) != TCL_OK && ! itPtr->adp.exception != ADP_RETURN && ! itPtr->adp.exception != ADP_BREAK && ! itPtr->adp.exception != ADP_ABORT) { ! Ns_TclLogError(interp); } Tcl_DecrRefCount(objv[0]); --- 164,172 ---- Tcl_IncrRefCount(objv[0]); Tcl_IncrRefCount(objv[1]); ! if (NsAdpInclude(itPtr, start, 2, objv) != TCL_OK ! && itPtr->adp.exception != ADP_RETURN ! && itPtr->adp.exception != ADP_BREAK ! && itPtr->adp.exception != ADP_ABORT) { ! Ns_TclLogError(interp); } Tcl_DecrRefCount(objv[0]); *************** *** 180,185 **** status = NS_OK; if (!(conn->flags & NS_CONN_SENTHDRS) ! && itPtr->adp.exception != ADP_ABORT) { ! status = AdpFlush(itPtr, 0); } --- 180,185 ---- status = NS_OK; if (!(conn->flags & NS_CONN_SENTHDRS) ! && itPtr->adp.exception != ADP_ABORT) { ! status = AdpFlush(itPtr, 0); } *************** *** 199,202 **** --- 199,203 ---- Tcl_DStringFree(&rds); Tcl_DStringFree(&tds); + return status; } *************** *** 208,219 **** * NsAdpFlush -- * ! * Flush current response output to connection. * * Results: ! * None. * * Side effects: ! * None unless streaming is enabled in which case AdpFlush ! * is called. * *---------------------------------------------------------------------- --- 209,220 ---- * NsAdpFlush -- * ! * Flush current response output to connection. * * Results: ! * None. * * Side effects: ! * None unless streaming is enabled in which case AdpFlush ! * is called. * *---------------------------------------------------------------------- *************** *** 224,235 **** { if (itPtr->adp.stream ! && itPtr->adp.responsePtr != NULL ! && itPtr->adp.responsePtr->length > 0) { ! if (AdpFlush(itPtr, 1) != NS_OK) { ! itPtr->adp.stream = 0; if (Ns_ConnGetChunkedFlag(itPtr->conn)) { Ns_ConnSetChunkedFlag(itPtr->conn, 0); } ! } } } --- 225,237 ---- { if (itPtr->adp.stream ! && itPtr->adp.responsePtr != NULL ! && itPtr->adp.responsePtr->length > 0) { ! ! if (AdpFlush(itPtr, 1) != NS_OK) { ! itPtr->adp.stream = 0; if (Ns_ConnGetChunkedFlag(itPtr->conn)) { Ns_ConnSetChunkedFlag(itPtr->conn, 0); } ! } } } *************** *** 241,251 **** * NsAdpStream -- * ! * Turn streaming mode on. * * Results: ! * None. * * Side effects: ! * Headers and current data, if any, are flushed. Can enable chunked * mode depending on the browser version. * --- 243,253 ---- * NsAdpStream -- * ! * Turn streaming mode on. * * Results: ! * None. * * Side effects: ! * Headers and current data, if any, are flushed. Can enable chunked * mode depending on the browser version. * *************** *** 276,286 **** * NsAdpCompress -- * ! * Turn on-the-fly compression on or off. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 278,288 ---- * NsAdpCompress -- * ! * Turn on-the-fly compression on or off. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 299,309 **** * NsAdpSetMimeType -- * ! * Sets the mime type and connection encoding for this adp. * * Results: ! * None. * * Side effects: ! * Type may effect output encoding charset. * *---------------------------------------------------------------------- --- 301,311 ---- * NsAdpSetMimeType -- * ! * Sets the mime type and connection encoding for this adp. * * Results: ! * None. * * Side effects: ! * Type may effect output encoding charset. * *---------------------------------------------------------------------- *************** *** 316,326 **** if (itPtr->adp.typePtr != NULL) { ! Tcl_DStringFree(itPtr->adp.typePtr); ! Tcl_DStringAppend(itPtr->adp.typePtr, type, -1); ! encoding = Ns_GetTypeEncoding(type); ! if (encoding != NULL) { ! Ns_ConnSetEncoding(itPtr->conn, encoding); Ns_ConnSetUrlEncoding(itPtr->conn, encoding); ! } } } --- 318,328 ---- if (itPtr->adp.typePtr != NULL) { ! Tcl_DStringFree(itPtr->adp.typePtr); ! Tcl_DStringAppend(itPtr->adp.typePtr, type, -1); ! encoding = Ns_GetTypeEncoding(type); ! if (encoding != NULL) { ! Ns_ConnSetEncoding(itPtr->conn, encoding); Ns_ConnSetUrlEncoding(itPtr->conn, encoding); ! } } } *************** *** 332,342 **** * NsFreeAdp -- * ! * Interp delete callback to free ADP resources. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 334,344 ---- * NsFreeAdp -- * ! * Interp delete callback to free ADP resources. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 347,351 **** { if (itPtr->adp.cache != NULL) { ! Ns_CacheDestroy(itPtr->adp.cache); } } --- 349,353 ---- { if (itPtr->adp.cache != NULL) { ! Ns_CacheDestroy(itPtr->adp.cache); } } *************** *** 357,367 **** * AdpFlush -- * ! * Flush the headers and/or ADP content. * * Results: ! * NS_OK or NS_ERROR if a connection write routine failed. * * Side effects: ! * Content is encoded and/or sent. * *---------------------------------------------------------------------- --- 359,369 ---- * AdpFlush -- * ! * Flush the headers and/or ADP content. * * Results: ! * NS_OK or NS_ERROR if a connection write routine failed. * * Side effects: ! * Content is encoded and/or sent. * *---------------------------------------------------------------------- *************** *** 390,396 **** encoding = Ns_ConnGetEncoding(conn); if (encoding != NULL) { ! Tcl_UtfToExternalDString(encoding, buf, len, &ds); ! buf = ds.string; ! len = ds.length; } --- 392,398 ---- encoding = Ns_ConnGetEncoding(conn); if (encoding != NULL) { ! Tcl_UtfToExternalDString(encoding, buf, len, &ds); ! buf = ds.string; ! len = ds.length; } *************** *** 405,418 **** if (itPtr->adp.compress ! && itPtr->servPtr->adp.compress.enable ! && !(conn->flags & NS_CONN_SENTHDRS) ! && !(conn->flags & NS_CONN_SKIPBODY) ! && !stream ! && len >= itPtr->servPtr->adp.compress.minsize ! && (ahdr = Ns_SetIGet(Ns_ConnHeaders(conn), ! "Accept-Encoding")) != NULL ! && strstr(ahdr, "gzip") != NULL ! && Ns_CompressGzip(buf, len, &cds, ! itPtr->servPtr->adp.compress.level) == NS_OK) { /* --- 407,420 ---- if (itPtr->adp.compress ! && itPtr->servPtr->adp.compress.enable ! && !(conn->flags & NS_CONN_SENTHDRS) ! && !(conn->flags & NS_CONN_SKIPBODY) ! && !stream ! && len >= itPtr->servPtr->adp.compress.minsize ! && (ahdr = Ns_SetIGet(Ns_ConnHeaders(conn), ! "Accept-Encoding")) != NULL ! && strstr(ahdr, "gzip") != NULL ! && Ns_CompressGzip(buf, len, &cds, ! itPtr->servPtr->adp.compress.level) == NS_OK) { /* *************** *** 432,440 **** if (!(conn->flags & NS_CONN_SENTHDRS)) { ! if (itPtr->servPtr->adp.enableexpire) { ! Ns_ConnCondSetHeaders(conn, "Expires", "now"); ! } ! Ns_ConnSetRequiredHeaders(conn, type, stream ? -1 : len); ! Ns_ConnQueueHeaders(conn, 200); } --- 434,442 ---- if (!(conn->flags & NS_CONN_SENTHDRS)) { ! if (itPtr->servPtr->adp.enableexpire) { ! Ns_ConnCondSetHeaders(conn, "Expires", "now"); ! } ! Ns_ConnSetRequiredHeaders(conn, type, stream ? -1 : len); ! Ns_ConnQueueHeaders(conn, 200); } *************** *** 451,455 **** result = Ns_WriteConn(conn, buf, len); if (result == NS_OK && !stream) { ! result = Ns_ConnClose(conn); } --- 453,457 ---- result = Ns_WriteConn(conn, buf, len); if (result == NS_OK && !stream) { ! result = Ns_ConnClose(conn); } *************** *** 457,460 **** --- 459,463 ---- Tcl_DStringFree(&cds); Tcl_DStringTrunc(itPtr->adp.responsePtr, 0); + return result; } |