You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(54) |
Feb
(71) |
Mar
(93) |
Apr
(48) |
May
(53) |
Jun
(33) |
Jul
(19) |
Aug
(39) |
Sep
(35) |
Oct
(36) |
Nov
(33) |
Dec
(13) |
| 2004 |
Jan
(10) |
Feb
(1) |
Mar
(17) |
Apr
(9) |
May
(40) |
Jun
(132) |
Jul
(133) |
Aug
(178) |
Sep
(104) |
Oct
(31) |
Nov
(80) |
Dec
(18) |
| 2005 |
Jan
(54) |
Feb
(9) |
Mar
(35) |
Apr
(2) |
May
(20) |
Jun
(3) |
Jul
(45) |
Aug
(202) |
Sep
(2) |
Oct
(26) |
Nov
|
Dec
(4) |
| 2006 |
Jan
|
Feb
(7) |
Mar
(8) |
Apr
(66) |
May
(9) |
Jun
(40) |
Jul
(4) |
Aug
(4) |
Sep
|
Oct
|
Nov
(1) |
Dec
(4) |
| 2007 |
Jan
(2) |
Feb
(14) |
Mar
(4) |
Apr
(1) |
May
(5) |
Jun
(5) |
Jul
|
Aug
(8) |
Sep
(3) |
Oct
(7) |
Nov
|
Dec
|
| 2008 |
Jan
(6) |
Feb
|
Mar
(1) |
Apr
(8) |
May
(46) |
Jun
(4) |
Jul
(1) |
Aug
|
Sep
(9) |
Oct
(3) |
Nov
|
Dec
(5) |
| 2009 |
Jan
(9) |
Feb
(2) |
Mar
(3) |
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(11) |
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(10) |
Aug
(5) |
Sep
(1) |
Oct
(13) |
Nov
|
Dec
(4) |
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
|
From: gustafn <gne...@us...> - 2011-07-05 18:24:42
|
Update of /cvsroot/aolserver/aolserver/nsd
In directory vz-cvs-4.sog:/tmp/cvs-serv21728
Modified Files:
queue.c server.c tclcache.c tclmisc.c uuencode.c
Log Message:
- using SQL escape string syntax E'...' when needed (required in PostgreSql 9.1)
- minor cleanup to get rid of compilation warnings
Index: tclmisc.c
===================================================================
RCS file: /cvsroot/aolserver/aolserver/nsd/tclmisc.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** tclmisc.c 23 Aug 2005 21:41:31 -0000 1.32
--- tclmisc.c 5 Jul 2011 18:24:40 -0000 1.33
***************
*** 366,370 ****
return TCL_ERROR;
}
! string = Tcl_GetStringFromObj(objv[1], &nbytes);
if (nbytes > 48) {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid string \"",
--- 366,374 ----
return TCL_ERROR;
}
! string = Tcl_GetString(objv[1]);
! nbytes = objv[1]->length;
! fprintf(stderr, "STRANGE %d %d\n",(unsigned char)string[0],(unsigned char)string[1]);
! /* string = Tcl_GetStringFromObj(objv[1], &nbytes);*/
!
if (nbytes > 48) {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid string \"",
Index: tclcache.c
===================================================================
RCS file: /cvsroot/aolserver/aolserver/nsd/tclcache.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tclcache.c 31 Jan 2009 21:35:08 -0000 1.3
--- tclcache.c 5 Jul 2011 18:24:40 -0000 1.4
***************
*** 189,192 ****
--- 189,194 ----
cachePtr = objv[2]->internalRep.otherValuePtr;
+ //fprintf(stderr,"CACHE %s %s\n",Tcl_GetString(objv[1]),Tcl_GetString(objv[2]));
+
Ns_GetTime(&now);
err = 0;
***************
*** 503,506 ****
--- 505,511 ----
}
cache = Tcl_GetString(objv[2]);
+
+ //fprintf(stderr,"CACHE create %s\n",cache);
+
wait.sec = 2;
ttl.sec = 60;
Index: queue.c
===================================================================
RCS file: /cvsroot/aolserver/aolserver/nsd/queue.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** queue.c 8 Dec 2009 04:12:19 -0000 1.47
--- queue.c 5 Jul 2011 18:24:40 -0000 1.48
***************
*** 556,559 ****
--- 556,639 ----
*/
+ /*
+ *----------------------------------------------------------------------
+ *
+ * ConnAuthorize --
+ *
+ * Try to authorize a connection.
+ *
+ * Results:
+ * NS_OK on successful authorization,
+ * NS_FILTER_RETURN on authorization failure, or
+ * NS_ERROR on error.
+ *
+ * Side effects:
+ * Connection request is authorized. On failure an alternative
+ * response may be sent to the client.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ static int
+ ConnAuthorize(Conn *connPtr)
+ {
+ Ns_Conn *conn = (Ns_Conn *) connPtr;
+ NsServer *servPtr = connPtr->servPtr;
+ int status;
+
+ status = Ns_AuthorizeRequest(servPtr->server,
+ connPtr->request->method, connPtr->request->url,
+ connPtr->authUser, connPtr->authPasswd, connPtr->peer);
+
+ switch (status) {
+ case NS_OK:
+ break;
+ case NS_FORBIDDEN:
+ /*
+ * NS_OK indicates that a response was sent to the client
+ * a this point, we must fast-forward to traces,
+ * so we convert the NS_OK to NS_FILTER_RETURN.
+ */
+ if ((status = Ns_ConnReturnForbidden(conn)) == NS_OK) {
+ status = NS_FILTER_RETURN;
+ }
+ break;
+ case NS_UNAUTHORIZED:
+ /*
+ * NS_OK indicates that a response was sent to the client
+ * a this point, we must fast-forward to traces,
+ * so we convert the NS_OK to NS_FILTER_RETURN.
+ */
+ if ((status = Ns_ConnReturnUnauthorized(conn)) == NS_OK) {
+ status = NS_FILTER_RETURN;
+ }
+ break;
+ case NS_ERROR:
+ default:
+ status = NS_ERROR;
+ break;
+ }
+
+ return status;
+ }
+
+
+ /*
+ *----------------------------------------------------------------------
+ *
+ * ConnRun --
+ *
+ * Run a valid connection.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Connection request is read and parsed and the cooresponding
+ * service routine is called.
+ *
+ *----------------------------------------------------------------------
+ */
+
static void
ConnRun(Conn *connPtr)
***************
*** 590,639 ****
*/
! if (connPtr->request->protocol != NULL && connPtr->request->host != NULL) {
! status = NsConnRunProxyRequest((Ns_Conn *) connPtr);
! } else {
! status = NsRunFilters(conn, NS_FILTER_PRE_AUTH);
! if (status == NS_OK) {
! status = Ns_AuthorizeRequest(servPtr->server,
! connPtr->request->method, connPtr->request->url,
! connPtr->authUser, connPtr->authPasswd, connPtr->peer);
! switch (status) {
! case NS_OK:
! status = NsRunFilters(conn, NS_FILTER_POST_AUTH);
! if (status == NS_OK) {
! status = Ns_ConnRunRequest(conn);
! }
! break;
! case NS_FORBIDDEN:
! Ns_ConnReturnForbidden(conn);
! break;
! case NS_UNAUTHORIZED:
! Ns_ConnReturnUnauthorized(conn);
! break;
! case NS_ERROR:
! default:
! Ns_ConnReturnInternalError(conn);
! break;
! }
! } else if (status != NS_FILTER_RETURN) {
! /* if not ok or filter_return, then the pre-auth filter coughed
! * an error. We are not going to proceed, but also we
! * can't count on the filter to have sent a response
! * back to the client. So, send an error response.
! */
! Ns_ConnReturnInternalError(conn);
! status = NS_FILTER_RETURN; /* to allow tracing to happen */
}
}
Ns_ConnClose(conn);
if (status == NS_OK || status == NS_FILTER_RETURN) {
! status = NsRunFilters(conn, NS_FILTER_TRACE);
! if (status == NS_OK) {
! (void) NsRunFilters(conn, NS_FILTER_VOID_TRACE);
! NsRunTraces(conn);
! }
}
--- 670,749 ----
*/
! while (1) {
! /*
! * Proxy requests replace request logic
! */
! if (connPtr->request->protocol != NULL
! && connPtr->request->host != NULL) {
! status = NsConnRunProxyRequest((Ns_Conn *) connPtr);
! break;
! }
!
! /*
! * Each stage of request processing can return one of three
! * possible results:
! * NS_OK means continue to next stage
! * NS_FILTER_RETURN means skip to traces
! * NS_ERROR means skip to 500 response attempt
! */
!
! status = NsRunFilters(conn, NS_FILTER_PRE_AUTH);
! if (status != NS_OK) {
! break;
}
+
+ status = ConnAuthorize(connPtr);
+ if (status != NS_OK) {
+ break;
+ }
+
+ status = NsRunFilters(conn, NS_FILTER_POST_AUTH);
+ if (status != NS_OK) {
+ break;
+ }
+
+ status = Ns_ConnRunRequest(conn);
+ break;
}
+
+ if (status == NS_ERROR) {
+ status = Ns_ConnReturnInternalError(conn);
+ }
+
+ /*
+ * Closing connection also runs code registered with
+ * ns_atclose.
+ */
+
Ns_ConnClose(conn);
+
+ /*
+ * Trace filters, void filter traces and server traces
+ * run a response was sent to the client
+ * Note that a successful response includes sending
+ * an internal server error response.
+ */
+
if (status == NS_OK || status == NS_FILTER_RETURN) {
! /*
! * Filter Traces are registered with ns_register_filter
! * Ignore the return code? We need to do NsRunTraces based
! * upon status before trace filters ran. Question is if we
! * should skip void trace filters. We could wrap them in another
! * status check, then move on to NsRunTraces.
! */
! NsRunFilters(conn, NS_FILTER_TRACE);
! /*
! * Filters registered outside the context of a particular server
! */
! (void) NsRunFilters(conn, NS_FILTER_VOID_TRACE);
! /*
! * Server traces registered with Ns_RegisterServerTrace
! * Access logging is handled at this point.
! */
! NsRunTraces(conn);
}
***************
*** 642,650 ****
--- 752,770 ----
* followed by free the connection interp if it was used.
*/
+
+ /*
+ * Cleanups are registered with either:
+ * Ns_RegisterConnCleanup: same signature as Ns_RegisterServerTrace
+ * Ns_RegisterCleanup: runs for all servers
+ */
NsRunCleanups(conn);
+
+ /* Finished with conn */
+
NsFreeConnInterp(connPtr);
}
+
/*
Index: server.c
===================================================================
RCS file: /cvsroot/aolserver/aolserver/nsd/server.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** server.c 5 Dec 2008 08:51:43 -0000 1.47
--- server.c 5 Jul 2011 18:24:40 -0000 1.48
***************
*** 298,302 ****
* is no encoding, i.e., assume UTF-8.
*/
-
GetCharsetEncoding(path, "urlcharset", NULL, &servPtr->urlEncoding);
--- 298,301 ----
Index: uuencode.c
===================================================================
RCS file: /cvsroot/aolserver/aolserver/nsd/uuencode.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** uuencode.c 22 Mar 2001 21:39:27 -0000 1.2
--- uuencode.c 5 Jul 2011 18:24:40 -0000 1.3
***************
*** 111,120 ****
p = input;
! q = output;
for (n = len / 3; n > 0; --n) {
*q++ = ENC(p[0] >> 2);
*q++ = ENC(((p[0] << 4) & 060) | ((p[1] >> 4) & 017));
*q++ = ENC(((p[1] << 2) & 074) | ((p[2] >> 6) & 03));
*q++ = ENC(p[2] & 077);
p += 3;
}
--- 111,130 ----
p = input;
! q = (unsigned char*)output;
for (n = len / 3; n > 0; --n) {
*q++ = ENC(p[0] >> 2);
+ fprintf(stderr,"1 (%d) %d\n",p[0] >> 2, p[0]);
+ *q++ = ENC(((p[0] & 0x03) << 4) | ((p[1] & 0xf0) >> 4));
+ fprintf(stderr,"2 (%d) %d %d\n",(((p[0] & 0x03) << 4) | ((p[1] & 0xf0) >> 4)), p[0], p[1]);
+ *q++ = ENC(((p[1] & 0x0f) << 2) | ((p[2] & 0xc0) >> 6));
+ fprintf(stderr,"3 (%d) %d %d\n",(((p[1] & 0x0f) << 2) | ((p[2] & 0xc0) >> 6)), p[1], p[2]);
+ *q++ = ENC(p[2] & 0x3f);
+ fprintf(stderr,"4 (%d) %d\n",(p[2] & 0x3f),p[2]);
+
+ /*
*q++ = ENC(((p[0] << 4) & 060) | ((p[1] >> 4) & 017));
*q++ = ENC(((p[1] << 2) & 074) | ((p[2] >> 6) & 03));
*q++ = ENC(p[2] & 077);
+ */
p += 3;
}
***************
*** 128,136 ****
*q++ = ENC(p[0] >> 2);
if (n == 1) {
! *q++ = ENC((p[0] << 4) & 060);
*q++ = '=';
} else {
! *q++ = ENC(((p[0] << 4) & 060) | ((p[1] >> 4) & 017));
! *q++ = ENC((p[1] << 2) & 074);
}
*q++ = '=';
--- 138,146 ----
*q++ = ENC(p[0] >> 2);
if (n == 1) {
! *q++ = ENC(((p[0] & 0x03) << 4));
*q++ = '=';
} else {
! *q++ = ENC(((p[0] & 0x03) << 4) | ((p[1] & 0xf0) >> 4));
! *q++ = ENC(((p[1] & 0x0f) << 2));
}
*q++ = '=';
|
|
From: gustafn <gne...@us...> - 2011-06-24 06:46:35
|
Update of /cvsroot/aolserver/aolserver/nsd
In directory vz-cvs-4.sog:/tmp/cvs-serv18293
Modified Files:
driver.c
Log Message:
- add log entry for 413
Index: driver.c
===================================================================
RCS file: /cvsroot/aolserver/aolserver/nsd/driver.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** driver.c 23 Jun 2011 18:15:16 -0000 1.60
--- driver.c 24 Jun 2011 06:46:32 -0000 1.61
***************
*** 1217,1221 ****
* Process sockets ready to run.
*/
-
while ((sockPtr = preqSockPtr) != NULL) {
preqSockPtr = sockPtr->nextPtr;
--- 1217,1220 ----
***************
*** 1753,1756 ****
--- 1752,1756 ----
if (err == E_CRANGE) {
Ns_ConnReturnEntityToLarge(connPtr);
+ NsRunTraces(connPtr);
}
}
|
|
From: gustafn <gne...@us...> - 2011-06-23 18:15:18
|
Update of /cvsroot/aolserver/aolserver/nsd
In directory vz-cvs-4.sog:/tmp/cvs-serv28631/nsd
Modified Files:
driver.c return.c
Log Message:
- added support for returning error 413, request entity too large
Index: return.c
===================================================================
RCS file: /cvsroot/aolserver/aolserver/nsd/return.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** return.c 7 Jul 2006 03:27:22 -0000 1.50
--- return.c 23 Jun 2011 18:15:16 -0000 1.51
***************
*** 1058,1062 ****
--- 1058,1089 ----
return Ns_ConnReturnStatus(conn, 304);
}
+
+ /*
+ *----------------------------------------------------------------------
+ *
+ * Ns_ConnReturnEntityToLarge --
+ *
+ * Return a 414 Request Entity to large response.
+ *
+ * Results:
+ * NS_OK/NS_ERROR
+ *
+ * Side effects:
+ * Will close the connection.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ int
+ Ns_ConnReturnEntityToLarge(Ns_Conn *conn)
+ {
+ int result;
+ if (ReturnRedirect(conn, 413, &result)) {
+ return result;
+ }
+ return Ns_ConnReturnNotice(conn, 413, "Request Entity Too Large",
+ "The request entity (e.g. file to be uploaded) is too large.");
+ }
/*
Index: driver.c
===================================================================
RCS file: /cvsroot/aolserver/aolserver/nsd/driver.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** driver.c 8 Dec 2009 04:12:19 -0000 1.59
--- driver.c 23 Jun 2011 18:15:16 -0000 1.60
***************
*** 1675,1679 ****
if (send(drvPtr->trigger[1], "", 1, 0) != 1) {
Ns_Fatal("driver: trigger send() failed: %s",
! ns_sockstrerror(ns_sockerrno));
}
}
--- 1675,1679 ----
if (send(drvPtr->trigger[1], "", 1, 0) != 1) {
Ns_Fatal("driver: trigger send() failed: %s",
! ns_sockstrerror(ns_sockerrno));
}
}
***************
*** 1751,1754 ****
--- 1751,1757 ----
}
LogReadError(connPtr, err);
+ if (err == E_CRANGE) {
+ Ns_ConnReturnEntityToLarge(connPtr);
+ }
}
}
|
|
From: Jeff R. <dv...@us...> - 2011-06-07 21:37:23
|
Update of /cvsroot/aolserver/aolserver In directory vz-cvs-4.sog:/tmp/cvs-serv1944 Modified Files: ChangeLog Log Message: Avoid race condition in thread startup where thread runs and may exit before being fully initialized. fixes SF bug #3313417 Index: ChangeLog =================================================================== RCS file: /cvsroot/aolserver/aolserver/ChangeLog,v retrieving revision 1.397 retrieving revision 1.398 diff -C2 -d -r1.397 -r1.398 *** ChangeLog 31 Oct 2010 12:34:00 -0000 1.397 --- ChangeLog 7 Jun 2011 21:37:21 -0000 1.398 *************** *** 1,2 **** --- 1,6 ---- + 2011-05-07 Jeff Rogers <dv...@di...> + * nsthread/pthread.c: change to use passed resultArg directly so + thread id is always set in ConnData struct. Fixes bug #3313417 + 2010-10-31 Gustaf Neumann <ne...@wu...> * nsd/init.tcl: The original code in _ns_getensemble blindly |
|
From: <dv...@us...> - 2009-12-24 19:51:00
|
Update of /cvsroot/aolserver/aolserver In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8140 Modified Files: ChangeLog Log Message: changes noted Index: ChangeLog =================================================================== RCS file: /cvsroot/aolserver/aolserver/ChangeLog,v retrieving revision 1.395 retrieving revision 1.396 diff -C2 -d -r1.395 -r1.396 *** ChangeLog 8 Dec 2009 15:33:59 -0000 1.395 --- ChangeLog 24 Dec 2009 19:50:52 -0000 1.396 *************** *** 1,2 **** --- 1,14 ---- + 2009-12-24 Jeff Rogers <dv...@di...> + + * include/nsthread.h: added pre-8.6 compatibility define + for Tcl_GetErrorLine + + * nsd/adpeval.c: + * nsd/tclloop.c: removed direct access to TclInterp->errorLine + for tcl api change in TIP #336 + + * nsd/init.tcl: added _ns_genensemble to recreate ensemble + commands in interpreter init script + 2009-12-08 Jim Davidson <jgd...@ao...> |
|
From: <dv...@us...> - 2009-12-24 19:50:45
|
Update of /cvsroot/aolserver/aolserver/nsd In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8044/nsd Modified Files: init.tcl Log Message: enable use of ensemble commands in init scripts Index: init.tcl =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/init.tcl,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** init.tcl 13 Apr 2006 19:06:28 -0000 1.33 --- init.tcl 24 Dec 2009 19:50:34 -0000 1.34 *************** *** 433,436 **** --- 433,458 ---- } + # + # _ns_genensemble - + # + # if the passed command is an ensemble, returns a command + # to recreate it + # otherwise, returns an empty string + # + + if {[catch {package require Tcl 8.5}]} { + proc _ns_getensemble {cmd} {} + } else { + proc _ns_getensemble {cmd} { + ::if {[::namespace ensemble exists $cmd]} { + ::array set _cfg [::namespace ensemble configure $cmd] + ::set _enns $_cfg(-namespace) + ::unset _cfg(-namespace) + ::set _encmd [::list namespace ensemble create -command $cmd {*}[::array get _cfg]] + return [::list namespace eval $_enns $_encmd]\n + } + } + } + # *************** *** 547,550 **** --- 569,573 ---- ::append _import [::list namespace import -force $_orig] \n } + ::append _import [_ns_getensemble $_cmnd] } |
|
From: <dv...@us...> - 2009-12-24 19:50:18
|
Update of /cvsroot/aolserver/aolserver/nsd In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7904/nsd Modified Files: adpeval.c tclloop.c Log Message: fixes for tcl8.6 compatibility Index: adpeval.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/adpeval.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** adpeval.c 28 Jun 2006 17:41:06 -0000 1.49 --- adpeval.c 24 Dec 2009 19:50:07 -0000 1.50 *************** *** 837,841 **** if (framePtr != NULL) { Ns_DStringPrintf(&ds, "\n at line %d of ", ! framePtr->line + interp->errorLine); } inc = ""; --- 837,841 ---- if (framePtr != NULL) { Ns_DStringPrintf(&ds, "\n at line %d of ", ! framePtr->line + Tcl_GetErrorLine(interp)); } inc = ""; Index: tclloop.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/tclloop.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tclloop.c 20 Jun 2008 08:06:32 -0000 1.3 --- tclloop.c 24 Dec 2009 19:50:08 -0000 1.4 *************** *** 158,162 **** char msg[32 + TCL_INTEGER_SPACE]; ! sprintf(msg, "\n (\"for\" body line %d)",interp->errorLine); Tcl_AddErrorInfo(interp, msg); } --- 158,162 ---- char msg[32 + TCL_INTEGER_SPACE]; ! sprintf(msg, "\n (\"for\" body line %d)",Tcl_GetErrorLine(interp)); Tcl_AddErrorInfo(interp, msg); } *************** *** 243,247 **** sprintf(msg, "\n (\"while\" body line %d)", ! interp->errorLine); Tcl_AddErrorInfo(interp, msg); } --- 243,247 ---- sprintf(msg, "\n (\"while\" body line %d)", ! Tcl_GetErrorLine(interp)); Tcl_AddErrorInfo(interp, msg); } *************** *** 461,465 **** sprintf(msg, "\n (\"foreach\" body line %d)", ! interp->errorLine); Tcl_AddObjErrorInfo(interp, msg, -1); break; --- 461,465 ---- sprintf(msg, "\n (\"foreach\" body line %d)", ! Tcl_GetErrorLine(interp)); Tcl_AddObjErrorInfo(interp, msg, -1); break; |
|
From: <dv...@us...> - 2009-12-24 19:50:16
|
Update of /cvsroot/aolserver/aolserver/include In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7904/include Modified Files: nsthread.h Log Message: fixes for tcl8.6 compatibility Index: nsthread.h =================================================================== RCS file: /cvsroot/aolserver/aolserver/include/nsthread.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** nsthread.h 23 Aug 2005 21:41:31 -0000 1.31 --- nsthread.h 24 Dec 2009 19:50:06 -0000 1.32 *************** *** 419,421 **** --- 419,429 ---- #endif /* NS_NOCOMPAT */ + /* + * tcl 8.6 and TIP 330/336 compatability + */ + + #if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6) + #define Tcl_GetErrorLine(interp) (interp->errorLine) + #endif + #endif /* NSTHREAD_H */ |
|
From: <jgd...@us...> - 2009-12-08 15:34:11
|
Update of /cvsroot/aolserver/aolserver In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv353 Modified Files: ChangeLog Log Message: Added one more note. Index: ChangeLog =================================================================== RCS file: /cvsroot/aolserver/aolserver/ChangeLog,v retrieving revision 1.394 retrieving revision 1.395 diff -C2 -d -r1.394 -r1.395 *** ChangeLog 8 Dec 2009 04:22:29 -0000 1.394 --- ChangeLog 8 Dec 2009 15:33:59 -0000 1.395 *************** *** 35,38 **** --- 35,41 ---- command and notes on usage in pre-queue and read filters. + * doc/ns_filter.n: Re-wrote man page to include new options + and a file upload progress example. + * doc/ns_cls.n (new file): * doc/ns_tls.n (new file): |
|
From: <jgd...@us...> - 2009-12-08 15:33:11
|
Update of /cvsroot/aolserver/aolserver/doc In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv32610 Modified Files: ns_filter.n Log Message: Re-wrote page to include new options and a file upload progress example. Index: ns_filter.n =================================================================== RCS file: /cvsroot/aolserver/aolserver/doc/ns_filter.n,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ns_filter.n 10 Apr 2003 22:01:14 -0000 1.4 --- ns_filter.n 8 Dec 2009 15:33:00 -0000 1.5 *************** *** 38,157 **** '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ! ns_register_filter, ns_register_proc, ns_register_trace \- Register a filter, proc or trace callback .SH SYNOPSIS - \fBns_register_filter \fIoption \fR?\fIarg arg ...\fR? .sp ! \fBns_register_proc \fIoption \fR?\fIarg arg ...\fR? .sp ! \fBns_register_trace \fIoption \fR?\fIarg arg ...\fR? .BE .SH DESCRIPTION .PP ! .SS ns_register_filter: ! Registers a Tcl filter script for the specified method/URL combination on a virtual server. The script can be called at one or more of three given times: pre-authorization, post-authorization before page data has been returned to the user, and after the connection has been processed and closed. ! This function will be called at the specified stage of a connection, if the method/URL combination for the filter matches the method/URL combination for the connection using glob style matching. ! The URLpattern can contain standard string-matching characters. For example, these are valid URL patterns: ! /employees/*.tcl ! /accounts/*/out ! Valid values for the "when" argument are: preauth, postauth, and trace. ! Using pre-authorization, the procedure will be called (assuming that the method/URL combination matches) just before authorization. If the procedure returns with a code of: ! .IP \fBTCL_OK\fR 12 ! (using: return "filter_ok"): The server will continue to the next pre-authorization filter for this connection, or, if there are no more pre-authorization filters, it will continue on with authorization. ! .IP \fBTCL_BREAK\fR 12 ! (using: return "filter_break"): The server will not process any more pre-authorization filters for this connection, and it will continue on with authorization. ! .IP \fBTCL_RETURN\fR 12 ! (using: return "filter_return"): The server will close the connection and will not run any more pre-authorization filters. It will not authorize the request, and it will not run the function registered for this METHOD/URL. It WILL run any trace functions registered for this METHOD/URL, usually including logging. It is assumed that the filter has sent a proper response (e.g., using ns_return) to the client before returning TCL_RETURN. .TP ! Using post-authorization, the procedure will be called (assuming that the method/URL combination matches) just after successful authorization. If the procedure returns: - .IP \fBTCL_OK\fR 12 - (using: return "filter_ok"): The server will continue to the next post-authorization filter for this connection, or, if there are no more post-authorization filters, it will run the function registered to handle this request. - .IP \fBTCL_BREAK\fR 12 - (using: return "filter_break"): The server will not process any more post-authorization filters for this connection, and it will run the function registered to handle this request. - .IP \fBTCL_RETURN\fR 12 - (using: return "filter_return"): The server will close the connection and will not run any more post-authorization filters and it will not run the function registered for this METHOD/URL. It WILL run any trace functions registered for this METHOD/URL, usually including logging. It is assumed that the filter has returned a proper response (e.g., using ns_return) to the client before returning TCL_RETURN. .TP ! Using trace, the procedure will be called (assuming that the method/URL combination match) after the connection has been totally processed and closed. If the procedure returns: - .IP \fBTCL_OK\fR 12 - (using: return "filter_ok"): The server will continue to the next trace filter. - .IP \fBTCL_BREAK\fR 12 - (using: return "filter_break"): The rest of the trace filters are ignored. - .IP \fBTCL_RETURN\fR 12 - (using: return "filter_break"): The rest of the trace filters are ignored. .PP ! \fBSyntax for the registered procedure:\fR ! The conn (connection) argument is optional for procedures registered by ns_register_filter if the procedure has 1 or 2 arguments (including why but not including conn). The following examples show the variations that can be used in this case: ! .CS ! .RE ! \fBns_register_filter\fR \fItrace\fR GET /noargs filter_noargs ! \fBns_register_filter\fR \fItrace\fR GET /context filter_context fnord ! \fBns_register_filter\fR \fItrace\fR GET /conncontext filter_conncontext ! proc filter_noargs { why } { ! ns_log Notice "filter noargs" ! return filter_ok ! } ;# filter_noargs ! proc filter_context { arg why } { ! ns_log Notice "filter context. Arg: $arg" ! return filter_ok ! } ;# filter_noargs ! proc filter_conncontext { conn arg why } { ! ns_log Notice "filter conn context" ! return filter_ok ! } ;# filter_noargs ! .CE ! The conn (connection) argument is required for procedures registered by ns_register_filter if the procedure has 3 or more arguments (including why but not including conn). The conn argument is automatically filled with the connection information. The first argument following conn will always take the value supplied by ns_register_filter, if there is one, or an empty value. The why argument at the end is automatically filled with the type of filter requested. All other arguments must supply a default value. The following examples show the variations that can be used in this case: ! .CS ! .RE ! \fBns_register_filter\fR \fIpostauth\fR GET /threeargs threeargs aaa ! \fBns_register_filter\fR \fIpostauth\fR GET /fourargs fourargs aaa bbb ccc ! proc threeargs { conn context { greeble bork } why } { ! ... ! } ; ! proc fourargs { conn context { greeble bork } {hoover quark} why } { ! ... ! } ; ! .CE ! When a GET of /threeargs is requested, the conn and why arguments will be filled automatically, the context argument will be assigned "aaa" and the greeble argument will be assigned the default value "bork". ! When a GET of /fourargs is requested, the conn and why arguments will be filled automatically, the context argument will be assigned "aaa", the greeble argument will be assigned "bbb", and the hoover argument will be assigned the default value "quark". ! .SS ns_register_trace: ! .IP "" 0 ! Register a Tcl trace script to a method and matching URL. ! (Note: This function is obsolete. Use \fBns_register_filter\fR instead.) ! \fBns_register_trace\fR registers a Tcl script as a trace for the specified method/URL combination. After the server handles the request for the specified method on an URL that matches the \fIURLpattern\fR, it calls the trace script with the connection id and any arguments (args) specified. ! The \fIURLpattern\fR can contain standard string-matching characters. For example, these are valid URLpatterns: ! /employees/*.tcl ! /accounts/*/out - Note - \fBns_register_trace\fR is similar to \fBns_register_proc\fR except that the pattern-matching for the URL is performed differently. With \fBns_register_proc\fR, the specified URL is used to match that URL and any URL below it in the hierarchy. Wildcards such as "*" are meaningful only for the final part of the URL, such as /scripts/*.tcl. With \fBns_register_trace\fR, the \fIURLpattern\fR is used to match URLs as a string with standard string-matching characters. - \fBns_register_proc\fR results in a single match, whereas multiple ns_register_trace's can be matched and will be called. .SH "SEE ALSO" ! ns_register_proc(n), ns_register_tag(n), ns_register_adptag(n) .CE .SH KEYWORDS --- 38,234 ---- '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ! ns_register_filter, ns_register_trace \- Register connection callbacks .SH SYNOPSIS .sp ! \fBns_register_trace \fImethod url script ?arg?\fR .sp ! \fBns_register_filter read\fR \fImethod url script ?arg?\fR ! .sp ! \fBns_register_filter prequeue\fR \fImethod url script ?arg?\fR ! .sp ! \fBns_register_filter preauth\fR \fImethod url script ?arg?\fR ! .sp ! \fBns_register_filter postauth\fR \fImethod url script ?arg?\fR ! .sp ! \fBns_register_filter write\fR \fImethod url script ?arg?\fR ! .sp ! \fBns_register_filter trace\fR \fImethod url script ?arg?\fR .BE .SH DESCRIPTION .PP + The \fBns_register_filter\fR and \fBns_register_trace\fR commands + arrange for a Tcl procedures to be called at the requested state + during a connections lifetime. + .PP + The \fImethod\fR and \fIurl\fR arguments are specified using + glob-style pattern matching to indicate for which requests the + \fIproc\fR should be invoked. This allows methods and/or urls to + match more than one filter, all of which would be executed in FIFO + order (unless a \fBfilter_break\fR or \fBfilter_return\fR exit code + is returned as described below). For example: ! .CS ! # Invoke myproc before connection processing for any method ! # of .tcl scripts in the /employees directory. ! ns_register_filter postauth * /employees/*.tcl myproc ! # Invoke monitor during read for file uploads at the /upload/* URL ! ns_register_filter read POST /upload/* monitor ! # Invoke logit at end of connection for all requests. ! ns_register_filter trace * * logit ! .CE ! .PP ! See the man pages for \fBstring(n)\fR for details on glob matching. ! Note this matching approach differs from that of the \fBns_register_proc\fR ! command which is designed to match the method exactly and the single ! most specific url pattern. ! .PP ! The \fIproc\fR argument is the name of a Tcl procedure to invoke ! when the connection has reached the requested state. The \fIproc\fR ! will be called with the string name of the connection state, e.g., ! \fIpostauth\fR, \fItrace\fR, etc. If an optional \fIarg\fR string ! is provided, that value will precede the reason string. ! .PP ! For \fBns_register_trace\fR, the results of the procedure call are ! ignored. For \fBns_register_filter\fR, the result must be ! one of the following strings: .TP ! \fBfilter_ok\fR ! The filter returned correctly and the server should continue ! invoking additional filters, if any. .TP ! \fBfilter_break\fR ! The filter returned correctly but the server should not ! invoke any additional filters. ! ! .TP ! \fBfilter_return\fR ! The filter returned correctly and as a side-effect generated a ! response to the client, for example, through a call to the ! \fBns_return\fR command. The server should not invoke additional ! filters and close the connection. .PP + If \fIproc\fR returns any other value or raises and exception, the + server will stop invoking filters, generate an error response, and + close the connection. ! .SH USAGE ! .TP ! \fBns_register_trace \fImethod url script ?arg?\fR ! This is equivalent to \fBns_register_filter trace\fR ! where the result is ignored. ! .TP ! \fBns_register_filter \fBread\fR \fImethod url script ?arg?\fR ! Invokes the given \fIproc\fR after each read from the client within ! the "driver" network I/O thread. This callback is deferred until the ! minimum of the requests+headers have been received. It can be ! useful to monitor the progress of a large file upload (see the ! \fBEXAMPLE\fR below). The interpreter and thread will remain the ! same for all \fBread\fR callbacks but may differ from that used for ! other callbacks. Also, as the procedure is not called within a ! connection thread, care must be taken that it executes quickly ! without blocking to avoid stalling the other network I/O being ! multiplexed by the driver thread. ! .TP ! \fBns_register_filter \fBprequeue\fR \fImethod url script ?arg?\fR ! Invokes the given \fIproc\fR after the request and content have ! been read from the client but before queueing for execution on a ! connection thread. This callback can be used to register other ! network I/O waits; see \fBns_quewait\fR for details and an example. ! The interpreter and thread used for \fBprequeue\fR callbacks will ! differ from those used for other callbacks. The \fBns_cls\fR command ! can be used to manage data between the interpreters. Also, as the ! procedure is not called within a connection thread, care must be ! taken that it executes quickly without blocking to avoid stalling ! the other network I/O being multiplexed in the driver thread. ! .TP ! \fBns_register_filter \fBpreauth\fR \fImethod url script ?arg?\fR ! Invoke \fIproc\fR just before the server performs request ! authorization. This callback will be invoked even if the ! requests is ultimately not authorized. ! .TP ! \fBns_register_filter \fBpostauth\fR \fImethod url script ?arg?\fR ! Invoke \fIproc\fR after successful authorization. If prior authorization ! fails, this callback will not be invoked. ! .TP ! \fBns_register_filter \fBwrite\fR \fImethod url script ?arg?\fR ! Invoke \fIproc\fR after each write to the client. Note the ! server normally buffers response output so this callback is ! normally not invoked on each \fBns_adp_puts\fR and potentially ! just once when flushing the connection output buffers. ! .TP ! \fBns_register_filter \fBtrace\fR \fImethod url script ?arg?\fR ! Invoke \fIproc\fR after the server has sent a response to the ! client and closed the connection. This can be useful for ! custom logging routines. ! .SH EXAMPLE ! .PP ! The following example uses a \fBread\fR filter to update status of ! a large HTTP POST to the /upload/\fIkey\fR url where \fIkey\fR is ! some client-specified unique value. While the upload is in progress, ! it can be monitored with repeated GET requests to the /status/\fIkey\fR ! url with the same \fIkey\fR: ! .CS ! # ! # Register procs to receive uploads and check status ! # mainted in an nsv array. ! # ! ns_register_proc POST /upload upload.post ! ns_register_proc GET /status upload.status ! proc upload.status {} { ! set key [ns_conn urlv 1] ! if {[catch {set status [nsv_get status $key]}]} { ! set status "unknown" ! } ! ns_return 200 text/plain $status ! } ! proc upload.post {} { ! set key [ns_conn urlv 1] ! nsv_unset status $key ! # ... do something with content ... ! ns_return 200 text/plain received ! } + # + # Register a read filter ot update status + # + + ns_register_filter read POST /upload/* upload.update + + proc upload.update {why} { + set key [ns_conn urlv 1] + set expected [ns_conn contentlength] + set received [ns_conn contentavail] + set status [list $expected $received] + nsv_set status $key $status + return filter_ok + } + .CE .SH "SEE ALSO" ! ns_register_proc(n), ns_register_tag(n), ns_register_adptag(n), ns_quewait(n) .CE .SH KEYWORDS |
|
From: <jgd...@us...> - 2009-12-08 04:22:38
|
Update of /cvsroot/aolserver/aolserver In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11578 Modified Files: ChangeLog Log Message: Latest updates Index: ChangeLog =================================================================== RCS file: /cvsroot/aolserver/aolserver/ChangeLog,v retrieving revision 1.393 retrieving revision 1.394 diff -C2 -d -r1.393 -r1.394 *** ChangeLog 15 May 2009 08:31:27 -0000 1.393 --- ChangeLog 8 Dec 2009 04:22:29 -0000 1.394 *************** *** 1,2 **** --- 1,47 ---- + 2009-12-08 Jim Davidson <jgd...@ao...> + + * include/ns.h: Changed definition of Ns_QueueWait, added + NS_FILTER_READ and NS_FILTER_WRITE constants and definition + for new Ns_ConnContentAvail. + + * nsd/Makefile: Added tclstore.o. + + * nsd/conn.c: Added Ns_ConnContentAvail routine and "avail" + option to ns_conn command. + + * nsd/connio.c: Add call to invoke new write filters. + + * nsd/driver.c: Fixed bugs with the pre-queue filter and + que-wait callback interfaces, added calls to read filters, + and added a socket state transition debug log message. + + * nsd/queue.c: Moved some connection setup/cleanup to the + driver to make pre-queue and read filters safer. + + * nsd/tclrequest.c: Added "read" and "write" options to + ns_register_filter. + + * nsd/tclstore.c (new file): + * nsd/tclsock.c: + * nsd/tclcmds.c: New ns_tls, ns_cls, and ns_quewait commands. + + * tcl/pools.tcl: Changed default timeout from 0 (no longer + supported) to 30. + + * doc/Ns_TempFile.3: + * doc/Ns_Filter.3: Added detail to what were man page stubs. + + * doc/Ns_ConnContent.3: Added detail on Ns_ConnContentAvail + command and notes on usage in pre-queue and read filters. + + * doc/ns_cls.n (new file): + * doc/ns_tls.n (new file): + * doc/ns_quewait.n (new file): Man pages for new commands. + + * doc/Ns_Cleanup.3 (new file): + * doc/Ns_RegisterServerTrace (new file): New man pages for + routines previously documented in Ns_Filter.3. + + 2009-05-15 Gustaf Neumann <ne...@wu...> |
|
From: <jgd...@us...> - 2009-12-08 04:13:54
|
Update of /cvsroot/aolserver/aolserver/tcl In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10591 Modified Files: pools.tcl Log Message: Changed timeout default to a valid value. Index: pools.tcl =================================================================== RCS file: /cvsroot/aolserver/aolserver/tcl/pools.tcl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pools.tcl 27 Dec 2008 00:36:39 -0000 1.5 --- pools.tcl 8 Dec 2009 04:13:46 -0000 1.6 *************** *** 35,39 **** set maxthreads [ns_config $cfgsection maxthreads 10] set maxconns [ns_config $cfgsection maxconnections 0] ! set timeout [ns_config $cfgsection threadtimeout 0] set spread [ns_config $cfgsection spread 20] --- 35,39 ---- set maxthreads [ns_config $cfgsection maxthreads 10] set maxconns [ns_config $cfgsection maxconnections 0] ! set timeout [ns_config $cfgsection threadtimeout 30] set spread [ns_config $cfgsection spread 20] |
Update of /cvsroot/aolserver/aolserver/doc In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10377 Modified Files: Ns_ConnContent.3 Ns_Filter.3 Ns_TempFile.3 Added Files: Ns_RegisterConnCleanup.3 Ns_RegisterServerTrace.3 ns_cls.n ns_quewait.n ns_tls.n Log Message: Doc updates. --- NEW FILE: Ns_RegisterConnCleanup.3 --- '\" '\" The contents of this file are subject to the AOLserver Public License '\" Version 1.1 (the "License"); you may not use this file except in '\" compliance with the License. You may obtain a copy of the License at '\" http://aolserver.com/. '\" '\" Software distributed under the License is distributed on an "AS IS" '\" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See '\" the License for the specific language governing rights and limitations '\" under the License. '\" '\" The Original Code is AOLserver Code and related documentation '\" distributed by AOL. '\" '\" The Initial Developer of the Original Code is America Online, '\" Inc. Portions created by AOL are Copyright (C) 1999 America Online, '\" Inc. All Rights Reserved. '\" '\" Alternatively, the contents of this file may be used under the terms '\" of the GNU General Public License (the "GPL"), in which case the '\" provisions of GPL are applicable instead of those above. If you wish '\" to allow use of your version of this file only under the terms of the '\" GPL and not to allow others to use your version of this file under the '\" License, indicate your decision by deleting the provisions above and '\" replace them with the notice and other provisions required by the GPL. '\" If you do not delete the provisions above, a recipient may use your '\" version of this file under either the License or the GPL. '\" '\" '\" $Header: /cvsroot/aolserver/aolserver/doc/Ns_RegisterConnCleanup.3,v 1.1 2009/12/08 04:13:18 jgdavidson Exp $ '\" '\" .so man.macros .TH Ns_Cleanup 3 4.5 AOLserver "AOLserver Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME Ns_RegisterCleanup, Ns_RegisterConnCleanup \- manage connection cleanup callbacks .SH SYNOPSIS .nf \fB#include "ns.h"\fR .sp void \fBNs_RegisterCleanup\fR(\fINs_TraceProc *proc, void *arg\fR) .sp void \fBNs_RegisterConnCleanup\fR(\fIchar *server, Ns_TraceProc *proc, void *arg\fR) .SH ARGUMENTS .AS Ns_TraceProc *proc .AP char *server in Name of virtual server. .AP void *arg in Arbitrary one-word value to pass to \fIproc\fR. .AP Ns_TraceProc *proc in Procedure to invoke at the end of connection processing. .BE .SH DESCRIPTION .PP These routines manage callbacks which are invoked in LIFO order at the end of a conneciton. .PP At the end of a connection, regardless of success or error, \fIproc\fR will be invoked. It should have arguments and result that match the type \fBNs_TraceProc\fR: .sp .CS typedef void (Ns_TraceProc)(void \fIarg\fR, Ns_Conn *\fIconn\fR); .CE .sp The \fIarg\fR will have the same values as passed to \fBNs_RegisterConnCleanup\fR when the callback was created. The \fIconn\fR will be a pointer to the current connection. The \fIproc\fR may perform any actions necessary to free resources which may have been allocated and initalized in the course of the connection. .PP \fBNs_RegisterCleanup\fR is equivalent to \fBNs_RegisterConnCleanup\fR with the \fIserver\fR argument set to the currently initializing server. .SH "SEE ALSO" Ns_RegisterFilter(3), Ns_RegisterServerTrace(3) .SH KEYWORDS trace, callback, cleanup --- NEW FILE: Ns_RegisterServerTrace.3 --- '\" '\" The contents of this file are subject to the AOLserver Public License '\" Version 1.1 (the "License"); you may not use this file except in '\" compliance with the License. You may obtain a copy of the License at '\" http://aolserver.com/. '\" '\" Software distributed under the License is distributed on an "AS IS" '\" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See '\" the License for the specific language governing rights and limitations '\" under the License. '\" '\" The Original Code is AOLserver Code and related documentation '\" distributed by AOL. '\" '\" The Initial Developer of the Original Code is America Online, '\" Inc. Portions created by AOL are Copyright (C) 1999 America Online, '\" Inc. All Rights Reserved. '\" '\" Alternatively, the contents of this file may be used under the terms '\" of the GNU General Public License (the "GPL"), in which case the '\" provisions of GPL are applicable instead of those above. If you wish '\" to allow use of your version of this file only under the terms of the '\" GPL and not to allow others to use your version of this file under the '\" License, indicate your decision by deleting the provisions above and '\" replace them with the notice and other provisions required by the GPL. '\" If you do not delete the provisions above, a recipient may use your '\" version of this file under either the License or the GPL. '\" '\" '\" $Header: /cvsroot/aolserver/aolserver/doc/Ns_RegisterServerTrace.3,v 1.1 2009/12/08 04:13:18 jgdavidson Exp $ '\" '\" .so man.macros .TH Ns_RegisterServerTrace 3 4.5 AOLserver "AOLserver Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME Ns_RegisterServerTrace \- invoke cleanup callbacks .SH SYNOPSIS .nf \fB#include "ns.h"\fR .sp void \fBNs_RegisterServerTrace\fR(\fIchar *server, Ns_TraceProc * proc, void *arg\fR) .SH ARGUMENTS .AS Ns_TraceProc *proc .AP char *server in Name of virtual server. .AP void *arg in Arbitrary one-word value to pass to \fIproc\fR. .AP Ns_TraceProc *proc in Procedure to invoke at the end of connection processing. .BE .SH DESCRIPTION .PP The \fBNs_RegisterServerTrace\fR routines registers a callbacks to be invoked in FIFO order at the end of a conneciton. The callback will only be invoked if the connection executed successfully. .PP At the end of a successful connection, \fIproc\fR will be invoked. It should have arguments and result that match the type \fBNs_TraceProc\fR: .sp .CS typedef void (Ns_TraceProc)(void \fIarg\fR, Ns_Conn *\fIconn\fR); .CE .sp The \fIarg\fR will have the same values as passed to \fBNs_RegisterConnCleanup\fR when the callback was created. The \fIconn\fR will be a pointer to the current connection. The \fIproc\fR may perform any actions necessary to free resources which may have been allocated and initalized in the course of the connection. .SH NOTE The \fBNs_RegisterConnCleanup\fR routine, which invokes callbacks in LIFO order whether the connection is successful or not, may be more appropriate for reclaiming resources allocated during a connection. .SH "SEE ALSO" Ns_RegisterConnCleanup(3), Ns_RegisterServerTrace(3) .SH KEYWORDS trace, callback, cleanup --- NEW FILE: ns_cls.n --- '\" '\" The contents of this file are subject to the AOLserver Public License '\" Version 1.1 (the "License"); you may not use this file except in '\" compliance with the License. You may obtain a copy of the License at '\" http://aolserver.com/. '\" '\" Software distributed under the License is distributed on an "AS IS" '\" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See '\" the License for the specific language governing rights and limitations '\" under the License. '\" '\" The Original Code is AOLserver Code and related documentation '\" distributed by AOL. '\" '\" The Initial Developer of the Original Code is America Online, '\" Inc. Portions created by AOL are Copyright (C) 1999 America Online, '\" Inc. All Rights Reserved. '\" '\" Alternatively, the contents of this file may be used under the terms '\" of the GNU General Public License (the "GPL"), in which case the '\" provisions of GPL are applicable instead of those above. If you wish '\" to allow use of your version of this file only under the terms of the '\" GPL and not to allow others to use your version of this file under the '\" License, indicate your decision by deleting the provisions above and '\" replace them with the notice and other provisions required by the GPL. '\" If you do not delete the provisions above, a recipient may use your '\" version of this file under either the License or the GPL. '\" '\" '\" $Header: /cvsroot/aolserver/aolserver/doc/ns_cls.n,v 1.1 2009/12/08 04:13:18 jgdavidson Exp $ '\" '\" .so man.macros .TH ns_cls n 4.6 AOLserver "AOLserver Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ns_cls \- connection local storage command .SH SYNOPSIS \fBns_cls \fBalloc\fR .sp \fBns_cls \fget\fR \fIid\fR .sp \fBns_cls \fset\fR \fIid\fR \fIstring\fR .BE .SH DESCRIPTION .PP The \fBns_cls\fR command provides Tcl-level access to the \fBNs_Cls\fR connection-local storage interface. This can be used to managed data between interpreters and threads where global variables cannot be utilized. The semantics are similar to the thread-local storage \fBNs_Tls\fR interface and \fBns_tls\fR commmand. .SH USAGE .PP With the \fBalloc\fR option, \fBns_cls\fR returns a unique integer indentifier later used with the \fBget\fR and \fBset\fR options. It is only safe to call \fBns_cls alloc\fR at server startup. The resulting \fIid\fR can be passed as an argument to callback registration routines, e.g., \fBns_register_filter\fR and \fBns_register_proc\fR. .PP The \fBset\fR and \fBget\fR options use the \fIid\fR returned by \fBalloc\fR to store and retrieve strings unique to the active connection, respectively. Space utilized for storage of the string is automatically reclaimed by the server whenever it is modified and when the connection is closed. .SH EXAMPLE See the \fBns_quewait\fR man page for an example of using \fBns_cls\fR. .SH "SEE ALSO" Ns_ClsAlloc(3), Ns_ClsGet(3), Ns_ClsSet(3), Ns_TlsAlloc(3), Ns_TlsGet(3), Ns_TlsSet(3), ns_quewait(n), ns_register_filter(n), ns_register_proc(n), .SH KEYWORDS callback, connection --- NEW FILE: ns_quewait.n --- '\" '\" The contents of this file are subject to the AOLserver Public License '\" Version 1.1 (the "License"); you may not use this file except in '\" compliance with the License. You may obtain a copy of the License at '\" http://aolserver.com/. '\" '\" Software distributed under the License is distributed on an "AS IS" '\" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See '\" the License for the specific language governing rights and limitations '\" under the License. '\" '\" The Original Code is AOLserver Code and related documentation '\" distributed by AOL. '\" '\" The Initial Developer of the Original Code is America Online, '\" Inc. Portions created by AOL are Copyright (C) 1999 America Online, '\" Inc. All Rights Reserved. '\" '\" Alternatively, the contents of this file may be used under the terms '\" of the GNU General Public License (the "GPL"), in which case the '\" provisions of GPL are applicable instead of those above. If you wish '\" to allow use of your version of this file only under the terms of the '\" GPL and not to allow others to use your version of this file under the '\" License, indicate your decision by deleting the provisions above and '\" replace them with the notice and other provisions required by the GPL. '\" If you do not delete the provisions above, a recipient may use your '\" version of this file under either the License or the GPL. '\" '\" '\" $Header: /cvsroot/aolserver/aolserver/doc/ns_quewait.n,v 1.1 2009/12/08 04:13:18 jgdavidson Exp $ '\" '\" .so man.macros .TH ns_quewait n 4.6 AOLserver "AOLserver Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ns_quewait \- pre-queue network I/O callback interface .SH SYNOPSIS \fBns_quewait \fIchanId\fR \fBreadable\fR \fItimeout script\fR .sp \fBns_quewait \fIchanId\fR \fBwritable\fR \fItimeout script\fR .BE .SH DESCRIPTION .PP The \fBns_quewait\fR command enables Tcl-level use of the \fBNs_QueueWait\fR event callback interface. This interface allows interacting with one or more, possibly blocking, network resources before a connection is queued for processing by a connection thread. The rationale is to perform possibly blocking and/or long-running network requests using an efficient event-driven programming approach instead of via blocking I/O calls during connection processing. An initial call to \fBns_quewait\fR can be performed in a connection filter registered with the \fBns_register_filter\fR command using the \fIprequeue\fR option; calling \fBns_quewait\fR at any other time will result in an error exception. .PP As callbacks occurs within a "driver" accept and read-ahead thread, the caller needs to be careful not to block reading or writing to the given channel which would stall the connection accept and read-ahead functions of the server. .SH USAGE .PP With the \fBreadable\fR option, the given \fIscript\fR will be invoked when content can be read from \fIchanId\fR without blocking. With the \fBwritable\fR option, the script will be invoked when content can be written to \fIchanId\fR without blocking. In both cases, the server will only wait up to the absolute time specified by \fItimeout\fR. The value of \fItimeout\fR can be onstructed using the \fBns_time\fR command. .PP Note that the server is monitoring the state of the channel's underlying socket; Tcl's normal buffering facilities may affect this result (see \fBfconfigure\fR for means to configure the buffering behavior of the channel). .PP When the \fIscript\fR is invoked, an additional argument will be appended to indicate why the callback is occuring. This will normally match the event for which the callback was registered, i.e., \fBreadable\fR or \fBwritable\fR but may also be one of the following: .TP \fBtimeout\fR The channel was not readable or writable in the given absolute \fItimeout\fR value. In this case, the callback could abort it's attempt to interact with the remote resource. .TP \fBdropped\fR The HTTP connection was dropped and will not be processed by a connection thread. The callback should perform whatever action is necessary to abort the remote network resource request. .SH EXAMPLE .PP The server-startup code uses a pre-queue filter which fires after all request and content data has been received from a client. It makes an async connection to remote network resource and uses \fBns_quewait\fR to interact with the remote server. .CS # Allocate a connection-local-storage (CLS) slot for the search results. set cls [ns_cls alloc] # Register a pre-queue filter to start the search I/O. ns_register_filter prequeue GET /search dosearch.prequeue $cls proc dosearch.prequeue {cls why} { set s [socket -async 192.168.1.10 8888] set now [ns_time] set timeout [ns_time incr $now 1]; # NB: Total time for send+recv. ns_quewait $s writable $timeout [list dosearch.quewait $cls $s $timeout] return filter_ok } # Callback to send/recv request to search server, storing result in CLS. proc dosearch.quewait {cls s timeout why} { switch $why { writable { puts $s "... send some search result ..." flush $s ns_quewait $s readable $timeout [list dosearch.quewait $cls $s $timeout] } readable { set result [gets $s] ns_cls set $cls $results } dropped - timeout - default { # NB: Clien drop, timeout, or error. close $s } } } # Connection procedure to display results stored in CLS. ns_register_proc GET /search dosearch.proc $cls proc dosearch.proc {cls} { ns_return 200 text/html "done: [ns_cls get $cls]" } .CE .SH "SEE ALSO" Ns_QueueWait(3), ns_cls(n), ns_register_filter(n) .SH KEYWORDS callback --- NEW FILE: ns_tls.n --- '\" '\" The contents of this file are subject to the AOLserver Public License '\" Version 1.1 (the "License"); you may not use this file except in '\" compliance with the License. You may obtain a copy of the License at '\" http://aolserver.com/. '\" '\" Software distributed under the License is distributed on an "AS IS" '\" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See '\" the License for the specific language governing rights and limitations '\" under the License. '\" '\" The Original Code is AOLserver Code and related documentation '\" distributed by AOL. '\" '\" The Initial Developer of the Original Code is America Online, '\" Inc. Portions created by AOL are Copyright (C) 1999 America Online, '\" Inc. All Rights Reserved. '\" '\" Alternatively, the contents of this file may be used under the terms '\" of the GNU General Public License (the "GPL"), in which case the '\" provisions of GPL are applicable instead of those above. If you wish '\" to allow use of your version of this file only under the terms of the '\" GPL and not to allow others to use your version of this file under the '\" License, indicate your decision by deleting the provisions above and '\" replace them with the notice and other provisions required by the GPL. '\" If you do not delete the provisions above, a recipient may use your '\" version of this file under either the License or the GPL. '\" '\" '\" $Header: /cvsroot/aolserver/aolserver/doc/ns_tls.n,v 1.1 2009/12/08 04:13:18 jgdavidson Exp $ '\" '\" .so man.macros .TH ns_tls n 4.6 AOLserver "AOLserver Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ns_tls \- thread local storage command .SH SYNOPSIS \fBns_tls \fBalloc\fR .sp \fBns_tls \fget\fR \fIid\fR .sp \fBns_tls \fset\fR \fIid\fR \fIstring\fR .BE .SH DESCRIPTION .PP The \fBns_tls\fR command provides Tcl-level access to the \fBNs_Tls\fR thread-local storage interface to manage data private to a thread and independent of the calling interpreter. .PP Normally Tcl global variables can be used to manage private data as interpreters are bound to threads. The \fBns_tls\fR command is provided for special cases where data needs to be shared among multiple interpreters in the same thread or between invocations of Tcl-script callbacks where the interpreter is re-initalized after each call (e.g., \fBns_sockcallback\fR). .SH USAGE .PP With the \fBalloc\fR option, \fBns_tls\fR returns a unique integer indentifier later used with the \fBget\fR and \fBset\fR options. It is only safe to call \fBns_tls alloc\fR at server startup. The resulting \fIid\fR can be passed as an argument to callback registration routines, e.g., \fBns_register_filter\fR and \fBns_register_proc\fR. .PP The \fBset\fR and \fBget\fR options use the \fIid\fR returned by \fBalloc\fR to store and retrieve strings unique to the active connection, respectively. Space utilized for storage of the string is automatically reclaimed when modified or when the thread exits. .SH "SEE ALSO" Ns_ClsAlloc(3), Ns_ClsGet(3), Ns_ClsSet(3), Ns_TlsAlloc(3), Ns_TlsGet(3), Ns_TlsSet(3), ns_sockcallback(n), ns_register_filter(n), ns_register_proc(n), .SH KEYWORDS callback, thread Index: Ns_ConnContent.3 =================================================================== RCS file: /cvsroot/aolserver/aolserver/doc/Ns_ConnContent.3,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Ns_ConnContent.3 19 Apr 2006 17:37:30 -0000 1.3 --- Ns_ConnContent.3 8 Dec 2009 04:13:18 -0000 1.4 *************** *** 34,42 **** .so man.macros ! .TH Ns_ConnContent 3 4.0 AOLserver "AOLserver Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ! Ns_ConnContent, Ns_ConnContentLength, Ns_ConnContentFd, Ns_ConnContentOnDisk \- Routines to access request content .SH SYNOPSIS .nf --- 34,42 ---- .so man.macros ! .TH Ns_ConnContent 3 4.6 AOLserver "AOLserver Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ! Ns_ConnContent, Ns_ConnContentLength, Ns_ConnContentAvail, Ns_ConnContentFd, Ns_ConnContentOnDisk \- routines to access request content .SH SYNOPSIS .nf *************** *** 50,53 **** --- 50,56 ---- .sp int + \fBNs_ConnContentAvail\fR(\fINs_Conn *conn\fR) + .sp + int \fBNs_ConnContentFd\fR(\fINs_Conn *conn\fR) .sp *************** *** 55,59 **** \fBNs_ConnContentOnDisk\fR(\fINs_Conn *conn\fR) .SH ARGUMENTS ! .AS Ns_Conn *conn in .AP Ns_Conn *conn in Pointer to given connection. --- 58,62 ---- \fBNs_ConnContentOnDisk\fR(\fINs_Conn *conn\fR) .SH ARGUMENTS ! .AS Ns_Conn *conn .AP Ns_Conn *conn in Pointer to given connection. *************** *** 62,85 **** .SH DESCRIPTION .PP ! These procedures provide access to the request content sent with a ! request. .TP char *\fBNs_ConnContent\fR Returns a pointer to the content in memory. The result of ! \fBNs_ConnContent\fR is not guarenteed to be null-terminated. Safe code should be careful to use the result of \fBNs_ConnContentLength\fR ! to avoid overrun. .TP int \fBNs_ConnContentFd\fR Returns a file descriptor to an open temporary file which contains ! the content. .TP int \fBNs_ConnContentLength\fR Returns the length of the memory buffer and/or the size of the open ! temporary file. Any trailing \r\n sent beyond the content from ! common browsers on a POST request is not included. .TP --- 65,117 ---- .SH DESCRIPTION .PP ! These procedures provide access to the content sent with a ! request, e.g., a FORM post or PUT data. .TP char *\fBNs_ConnContent\fR Returns a pointer to the content in memory. The result of ! \fBNs_ConnContent\fR is not guaranteed to be null-terminated. Safe code should be careful to use the result of \fBNs_ConnContentLength\fR ! to avoid overrun. Small content is in memory only; larger content ! is mapped from an opened temporary file. The result is managed by ! the server; the caller should not attempt to free or unmap the result. ! .sp ! NOTE: Attempting to invoke \fBNs_ConnContent\fR for large content ! simultaneously in many active connection threads may lead to the ! server running out of virtual memory. For large content (e.g., ! large multipart file uploads), it's best ! to access the content incrementally via the open temporary file ! available via \fBNs_ConnContentFd\fR. .TP int \fBNs_ConnContentFd\fR Returns a file descriptor to an open temporary file which contains ! the content. Large content begin in a temporary file and smaller ! requests are copied to a file when requested. Open file is managed ! by the server; the caller should not close it directly. ! .sp ! NOTE: See the \fBNs_GetTemp\fR routine to details on how the ! open file is managed within the server. .TP int \fBNs_ConnContentLength\fR Returns the length of the memory buffer and/or the size of the open ! temporary file which has (or will be) uploaded from the client. ! Any trailing \r\n sent beyond the content from ! common browsers on a POST request is not included. As noted below, ! all content is pre-read before connection processing begins. The ! only exception is in a possible NS_FILTER_READ filter which will ! fire after any read requests after the HTTP request and header lines ! have been received. See \fBNs_ConnContentAvail\fR for more detail. ! ! .TP ! int \fBNs_ConnContentAvail\fR ! Returns the number of bytes currently uploaded. As noted below, all ! content is pre-read before connection processing begins so the result ! of this routine will always equal that of \fBNs_ConnContentLength\fR ! with the possible exception of being called within an NS_FILTER_READ ! filter callback where it may be less (all content not yet received) ! or perhaps more before the server truncates any spurious content ! received (e.g., any trailing \\r\\n from a form upload). .TP *************** *** 102,108 **** There is no need for a request processing extension to consider possible delays in reading content from the client as all content ! is available before connection processing begins. The rationale for this approach is that the driver thread can efficiently multiplex ! reading content for serveral request, tolerating any network delays. Legacy direct content reading routines, for example, \fBNs_ConnRead\fR, are now emulated on top of the \fBNs_ConnContent\fR. --- 134,150 ---- There is no need for a request processing extension to consider possible delays in reading content from the client as all content ! is available before connection processing begins. The only exception ! is during an NS_FILTER_READ callback (see \fBNs_RegisterCallback\fR ! which will fire within ! the thread performing the pre-read, possibly before any content has ! been received. The difference between the results of ! \fBNs_ConnContentLength\fR and \fBNs_ConnContentAvail\fR may be used ! to determine if all content is not yet available during a read ! filter; accessing partially uploaded content is not safe. ! ! .PP ! The rationale for this approach is that the driver thread can efficiently multiplex ! reading content for several request, tolerating any network delays. Legacy direct content reading routines, for example, \fBNs_ConnRead\fR, are now emulated on top of the \fBNs_ConnContent\fR. *************** *** 133,137 **** The design goal of the server is to support the ordinary case of reasonably small content requests (i.e., POST forms and small file ! uploads) in a convienent way without limiting a custom app to support very large requests. In particular, a call to \fBNs_ConnGetQuery\fR for a \fImultipart/file-upload\fR POST will result in an implicit --- 175,179 ---- The design goal of the server is to support the ordinary case of reasonably small content requests (i.e., POST forms and small file ! uploads) in a convenient way without limiting a custom app to support very large requests. In particular, a call to \fBNs_ConnGetQuery\fR for a \fImultipart/file-upload\fR POST will result in an implicit *************** *** 150,154 **** .SH "SEE ALSO" ! Ns_Conn(3), Ns_ConnRead(3), ns_limits(n), ns_conn(n) .SH KEYWORDS --- 192,196 ---- .SH "SEE ALSO" ! Ns_Conn(3), Ns_ConnRead(3), Ns_GetTemp(3), ns_limits(n), ns_conn(n) .SH KEYWORDS Index: Ns_Filter.3 =================================================================== RCS file: /cvsroot/aolserver/aolserver/doc/Ns_Filter.3,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Ns_Filter.3 10 Apr 2003 22:00:42 -0000 1.5 --- Ns_Filter.3 8 Dec 2009 04:13:18 -0000 1.6 *************** *** 34,61 **** .so man.macros ! .TH Ns_Filter 3 4.0 AOLserver "AOLserver Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ! Ns_RegisterCleanup, Ns_RegisterConnCleanup, Ns_RegisterFilter, Ns_RegisterServerTrace \- library procedures .SH SYNOPSIS .nf \fB#include "ns.h"\fR .sp ! \fBNs_RegisterCleanup\fR(\fIarg, arg\fR) ! .sp ! \fBNs_RegisterConnCleanup\fR(\fIarg, arg\fR) ! .sp ! \fBNs_RegisterFilter\fR(\fIarg, arg\fR) ! .sp ! \fBNs_RegisterServerTrace\fR(\fIarg, arg\fR) .BE .SH DESCRIPTION .PP ! These functions ... .SH "SEE ALSO" ! nsd(1), info(n) .SH KEYWORDS --- 34,163 ---- .so man.macros ! .TH Ns_Filter 3 4.6 AOLserver "AOLserver Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ! Ns_RegisterFilter \- manage callbacks during a connection .SH SYNOPSIS .nf \fB#include "ns.h"\fR .sp ! void ! \fBNs_RegisterFilter\fR(\fIchar *server, char *method, char *url, Ns_FilterProc *proc, int when, void *arg\fR) ! ! .SH ARGUMENTS ! .AS Ns_FilterProc *proc ! .AP char *server in ! Name of virtual server. ! ! .AP char *method in ! Glob matching pattern for requested methods. ! ! .AP char *url in ! Glob matching pattern for requested urls. ! ! .AP int when in ! OR-ed combination of the values \fBNS_FILTER_READ\fR, ! \fBNS_FILTER_PRE_QUEUE\fR, \fBNS_FILTER_PRE_AUTH\fR, ! \fBNS_FILTER_POST_AUTH\fR, \fBNS_FILTER_WRITE\fR, and ! \fBNS_FILTER_TRACE\fI indicating the connection state at ! which \fIproc\fR should be invoked. ! ! .AP void *arg in ! Arbitrary one-word value to pass to \fIproc\fR. ! ! .AP Ns_FilterProc *proc in ! Procedure to invoke when the connection reaches a requested ! state. ! .BE + .SH DESCRIPTION .PP ! \fBNs_RegisterFilter\fR may be called during server initialization to ! register callbacks to execute at various points during the connection ! lifetime. ! ! .PP ! The \fIwhen\fR argument to \fBNs_RegisterFilter\fR indicates when the ! callback is to be invoked. It consists of an OR-ed combinations of ! any of the following values: ! .TP ! NS_FILTER_READ ! Invoke \fIproc\fR after each read from the client. If there is no ! content to be uploaded (e.g., a simple GET request), this callback ! will fire just once after the HTTP request and headers lines have ! been read (which is considered the minimum context required for a ! valid connection). If content is to be uploaded (e.g., on a PUT ! request with a non-zero Content-length: header), the routine will ! be invoked after any subsequent reads which may be required to ! receive the uploaded content. During this phase, the result of ! \fBNs_ConnContentAvail\fR may be less than \fBNs_ConnContentLength\fR, ! indicating content has not fully been uploaded. ! If \fIproc\fR ! returns a value other than \fBNS_OK\fR, the connection will be ! aborted. ! ! .sp ! NOTE(1): It is not safe to access the connection content during an ! \fBNS_FILTER_READ\fR callback with, e.g., a call to \fBNs_ConnContent\fR. ! It is only safe to access the connction request and headers and ! query the upload progress. ! ! .sp ! NOTE(2): This callback will be invoked in a thread other than the ! thread used to process the connection. This may either be ! the "driver" thread used to accept and multiplex reads for all normal ! socket connections or one of the specialized read-ahead threads ! used to handle SSL connections. In either case, it will not be ! possible to store context in thread-local storage to be later accessed ! during connection processing. See the \fBNs_ClsAlloc\fR, \fBNs_ClsSet\fR, and ! \fBNs_ClsGet\fR \fIconnection local storage\fR routines for a method to ! store arbitary context between threads. ! ! .sp ! NOTE(3): Any \fBTcl_Interp\fR allocated with \fBNs_GetConnInterp\fR ! will be released before switching threads, clearing any global ! variables or other state you may have set. Again, use \fIconnection ! local stoarge\fR interface with the \fBns_cls\fR command for this ! purpose. ! ! .TP ! NS_FILTER_PRE_QUEUE ! Invoke \fIproc\fR after all content has been read from the client. ! This callback will occur just once within the single "driver" thread ! and can be used to register one or more \fBNs_QueueWait\fR callbacks ! to access addition, possibly blocking network resources before ! queueing the thread for processing. ! If this \fIproc\fR returns a value other than \fBNS_OK\fR, the conneciton ! will be aborted. ! ! .sp ! NOTE: See the comments above for \fBNS_FILTER_READ\fR for caveats ! of \fIproc\fR being invoked in a thread other than the conneciton ! processing thread. ! ! .TP ! NS_FILTER_PRE_AUTH ! Invoke \fIproc\fR just before connection authentication. ! ! .TP ! NS_FILTER_POST_AUTH ! Invoke \fIproc\fR just after a successful authentication. ! ! .TP ! NS_FILTER_WRITE ! Invoke \fIproc\fR after each write to the client. ! If \fIproc\fR ! returns a value other than \fBNS_OK\fR, the connection will be ! aborted. ! ! .TP ! NS_FILTER_TRACE ! .SH "SEE ALSO" ! Ns_RegisterConnCleanup(3), ns_register_filter(n), Ns_RegisterServerTrace(3) .SH KEYWORDS Index: Ns_TempFile.3 =================================================================== RCS file: /cvsroot/aolserver/aolserver/doc/Ns_TempFile.3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Ns_TempFile.3 28 Sep 2002 19:58:27 -0000 1.1 --- Ns_TempFile.3 8 Dec 2009 04:13:18 -0000 1.2 *************** *** 34,58 **** .so man.macros ! .TH Ns_TempFile 3 4.0 AOLserver "AOLserver Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ! Ns_GetTemp, Ns_ReleaseTemp \- library procedures .SH SYNOPSIS .nf \fB#include "ns.h"\fR .sp ! \fBNs_GetTemp\fR(\fIarg, arg\fR) .sp ! \fBNs_ReleaseTemp\fR(\fIarg, arg\fR) .BE .SH DESCRIPTION .PP ! These functions ... .SH "SEE ALSO" ! nsd(1), info(n) .SH KEYWORDS ! --- 34,97 ---- .so man.macros ! .TH Ns_GetTemp 3 4.5 AOLserver "AOLserver Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME ! Ns_GetTemp, Ns_ReleaseTemp \- routines for efficient open temp files .SH SYNOPSIS .nf \fB#include "ns.h"\fR .sp ! int ! \fBNs_GetTemp\fR(\fIvoid\fR) .sp ! void ! \fBNs_ReleaseTemp\fR(\int fd\fR) ! .AS int fd ! .AP int fd in ! File descriptor for open temp file returned from a prior call to \fBNs_GetTemp\fR. .BE .SH DESCRIPTION .PP ! The \fBNs_GetTemp\fR and \fBNs_Release\fR routines provide a means to efficiently ! use open temporary files when necessary to handle data too large for in-memory ! structures or to facilitate passing content to forked processes. The ! approach is to leave some files open when not in use, avoiding comparably expensive ! \fBcreat\fR and \fBclose\fR system calls in favor of quick \fBftruncate\fR's. ! The server uses this interface internally to support large-content uploads into ! temp files (see \fBNs_ConnContentFd\fR) and to support the open files needed ! to send content to and from CGI's. ! ! .TP ! int \fBNs_GetTemp(void)\fR ! To use a temporary file, call \fBNs_GetTemp\fR. The result will be a a file ! descriptor to an empty file opened in read+write mode located in a ! server-configure temporary location. If no more files can be opened, the result ! is -1. The open file descriptor can then be used to write content, seek to any ! location, and read back bytes. When no longer needed, the file descriptor ! can be released by passing it to \fBNs_ReleaseTemp\fR. ! .sp ! An open file returned by \fBNs_GetTemp\fR may also be used with a higher-level ! buffering API, e.g. \fBfdopen\fR to get an open \fIFILE *\fR object. In the case ! it is inconvenient or not possible to later disassociate the open file descriptor, ! the API's close routine (e.g., \fBfclose\fR) can be called instead of ! \fBNs_ReleaseTemp\fR. While the temp file cannot be efficient re-used in this case, ! such usage will not lead to any underlying resource leaks or corruption. ! .sp ! Note that the actual underlying file cannot be accessed by name outside of the ! running server. On Unix, the files are deleted just after open for the first ! time and on Windows the \fI_SH_DENYRW\fR flag inhibits sharing. This is done ! both to ensure cleanup at server shutdown or failure and also provides a security benefit, inhibiting other processes from being able to view the content ! temporarily stored in the files. ! ! .TP ! void \fBNs_ReleaseTemp(int fd)\fR ! \fBNs_ReleaseTemp\fR returns an open file descriptor to a cache for re-use, ! first truncating any data which may be present. .SH "SEE ALSO" ! Ns_ConnContentFd(3) .SH KEYWORDS ! file \ No newline at end of file |
Update of /cvsroot/aolserver/aolserver/nsd In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9603 Modified Files: Makefile conn.c connio.c driver.c queue.c tclcmds.c tclrequest.c tclsock.c Added Files: tclstore.c Log Message: Added read and write filters, fixed bugs with pre-queue filters and que-wait callbacks, added ns_tls, ns_cls, and ns_quewait commands. --- NEW FILE: tclstore.c --- /* * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is AOLserver Code and related documentation * distributed by AOL. * * The Initial Developer of the Original Code is America Online, * Inc. Portions created by AOL are Copyright (C) 1999 America Online, * Inc. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms * of the GNU General Public License (the "GPL"), in which case the * provisions of GPL are applicable instead of those above. If you wish * to allow use of your version of this file only under the terms of the * GPL and not to allow others to use your version of this file under the * License, indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the GPL. * If you do not delete the provisions above, a recipient may use your * version of this file under either the License or the GPL. */ /* * tclstore.c -- * * Thread and connection local storage Tcl commands. */ static const char *RCSID = "@(#) $Header: /cvsroot/aolserver/aolserver/nsd/tclstore.c,v 1.1 2009/12/08 04:12:20 jgdavidson Exp $, compiled: " __DATE__ " " __TIME__; #include "nsd.h" /* * Static functions defined in this file. */ static int StoreObjCmd(ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj **objv, int tls); /* *---------------------------------------------------------------------- * * NsTclTlsObjCmd, NsTclClsObjCmd -- * * Implements ns_tls and ns_cls as obj commands. * * Results: * Tcl result. * * Side effects: * See docs. * *---------------------------------------------------------------------- */ int NsTclTlsObjCmd(ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj **objv, Ns_Conn *conn) { return StoreObjCmd(data, interp, objc, objv, 1); } int NsTclClsObjCmd(ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj **objv, Ns_Conn *conn) { return StoreObjCmd(data, interp, objc, objv, 0); } static int StoreObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj **objv, int tls) { static CONST char *opts[] = { "alloc", "get", "set", NULL }; enum { AllocIdx, GetIdx, SetIdx } _nsmayalias opt; Ns_Conn *conn; char *val; int id; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], opts, "option", 0, (int *) &opt) != TCL_OK) { return TCL_ERROR; } if (opt == AllocIdx) { if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } if (tls) { Ns_TlsAlloc((Ns_Tls *) &id, ns_free); } else { Ns_ClsAlloc((Ns_Cls *) &id, ns_free); } Tcl_SetObjResult(interp, Tcl_NewIntObj(id)); } else { if (!tls && NsTclGetConn((NsInterp *) arg, &conn) != TCL_OK) { return TCL_ERROR; } if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[2], &id) != TCL_OK) { return TCL_ERROR; } if (id < 1 || id >= (tls ? NS_THREAD_MAXTLS : NS_CONN_MAXCLS)) { Tcl_AppendResult(interp, "invalid id: ", Tcl_GetString(objv[2]), NULL); return TCL_ERROR; } if (tls) { val = Ns_TlsGet((Ns_Tls *) &id); } else { val = Ns_ClsGet((Ns_Cls *) &id, conn); } if (opt == GetIdx) { Tcl_SetResult(interp, val, TCL_VOLATILE); } else { if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "index value"); return TCL_ERROR; } if (val) { ns_free(val); } val = ns_strdup(Tcl_GetString(objv[3])); if (tls) { Ns_TlsSet((Ns_Tls *) &id, (void **) val); } else { Ns_ClsSet((Ns_Cls *) &id, conn, (void **) val); } } } return TCL_OK; } Index: Makefile =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/Makefile,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Makefile 27 Jun 2006 16:35:55 -0000 1.52 --- Makefile 8 Dec 2009 04:12:19 -0000 1.53 *************** *** 48,52 **** tclhttp.o tclimg.o tclinit.o tcljob.o tclloop.o tclmisc.o \ tclobj.o tclrequest.o tclresp.o tclsched.o tclset.o tclshare.o \ ! tclsock.o tclthread.o tclvar.o tclxkeylist.o url.o \ urlencode.o urlopen.o urlspace.o uuencode.o stamp.o --- 48,52 ---- tclhttp.o tclimg.o tclinit.o tcljob.o tclloop.o tclmisc.o \ tclobj.o tclrequest.o tclresp.o tclsched.o tclset.o tclshare.o \ ! tclsock.o tclstore.o tclthread.o tclvar.o tclxkeylist.o url.o \ urlencode.o urlopen.o urlspace.o uuencode.o stamp.o Index: conn.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/conn.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** conn.c 29 Sep 2007 20:08:52 -0000 1.49 --- conn.c 8 Dec 2009 04:12:19 -0000 1.50 *************** *** 144,148 **** * Ns_ConnContentLength -- * ! * Get the content length from the client * * Results: --- 144,150 ---- * Ns_ConnContentLength -- * ! * Get the content length to be sent from the client. ! * Note the data may not have been all received if ! * called in a "read" filter callback. * * Results: *************** *** 165,168 **** --- 167,197 ---- *---------------------------------------------------------------------- * + * Ns_ConnContentAvail -- + * + * Get the content currently available from the client. + * This will generally be all content unless it's called + * during a read filter callback during upload. + * + * Results: + * An integer content length, or 0 if none sent + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + int + Ns_ConnContentAvail(Ns_Conn *conn) + { + Conn *connPtr = (Conn *) conn; + + return connPtr->avail; + } + + + /* + *---------------------------------------------------------------------- + * * Ns_ConnContent -- * *************** *** 1007,1012 **** static CONST char *opts[] = { ! "authpassword", "authuser", "channel", "close", "content", "contentlength", ! "contentsentlength", "contentchannel", "copy", "driver", "encoding", "files", "fileoffset", "filelength", "fileheaders", "flags", "form", --- 1036,1041 ---- static CONST char *opts[] = { ! "authpassword", "authuser", "channel", "close", ! "contentavail", "content", "contentlength", "contentsentlength", "contentchannel", "copy", "driver", "encoding", "files", "fileoffset", "filelength", "fileheaders", "flags", "form", *************** *** 1015,1022 **** "query", "request", "server", "sock", "start", "status", "url", "urlc", "urlencoding", "urlv", "version", ! "write_encoded", NULL }; enum { ! CAuthPasswordIdx, CAuthUserIdx, CChannelIdx, CCloseIdx, CContentIdx, CContentLengthIdx, CContentSentLenIdx, CContentChannelIdx, CCopyIdx, CDriverIdx, CEncodingIdx, CFilesIdx, CFileOffIdx, CFileLenIdx, --- 1044,1051 ---- "query", "request", "server", "sock", "start", "status", "url", "urlc", "urlencoding", "urlv", "version", ! "write_encoded", "interp", NULL }; enum { ! CAuthPasswordIdx, CAuthUserIdx, CChannelIdx, CCloseIdx, CAvailIdx, CContentIdx, CContentLengthIdx, CContentSentLenIdx, CContentChannelIdx, CCopyIdx, CDriverIdx, CEncodingIdx, CFilesIdx, CFileOffIdx, CFileLenIdx, *************** *** 1026,1030 **** CProtocolIdx, CQueryIdx, CRequestIdx, CServerIdx, CSockIdx, CStartIdx, CStatusIdx, CUrlIdx, CUrlcIdx, CUrlEncodingIdx, ! CUrlvIdx, CVersionIdx, CWriteEncodedIdx } opt; --- 1055,1059 ---- CProtocolIdx, CQueryIdx, CRequestIdx, CServerIdx, CSockIdx, CStartIdx, CStatusIdx, CUrlIdx, CUrlcIdx, CUrlEncodingIdx, ! CUrlvIdx, CVersionIdx, CWriteEncodedIdx, CInterpIdx } opt; *************** *** 1078,1081 **** --- 1107,1114 ---- break; + case CAvailIdx: + Tcl_SetIntObj(result, connPtr->avail); + break; + case CContentChannelIdx: fd = Ns_ConnContentFd(conn); *************** *** 1357,1360 **** --- 1390,1397 ---- } break; + + case CInterpIdx: + Tcl_SetLongObj(result, (long) interp); + break; } Index: connio.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/connio.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** connio.c 19 Apr 2006 17:48:43 -0000 1.27 --- connio.c 8 Dec 2009 04:12:19 -0000 1.28 *************** *** 375,378 **** --- 375,382 ---- nwrote = n; } + if (nwrote >= 0 + && NsRunFilters((Ns_Conn *) connPtr, NS_FILTER_WRITE) != NS_OK) { + nwrote = -1; + } return nwrote; } Index: driver.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/driver.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** driver.c 29 Jan 2009 20:54:24 -0000 1.58 --- driver.c 8 Dec 2009 04:12:19 -0000 1.59 *************** *** 44,47 **** --- 44,48 ---- enum { + SOCK_ACCEPT, /* Socket has just been accepted. */ SOCK_READWAIT, /* Waiting for request or content from client. */ SOCK_PREQUE, /* Ready to invoke pre-queue filters. */ *************** *** 49,53 **** --- 50,56 ---- SOCK_RUNWAIT, /* Ready to run when allowed by connection limits. */ SOCK_RUNNING, /* Running in a connection queue. */ + SOCK_CLOSEREQ, /* Close request in a read or pre-queue filter. */ SOCK_CLOSEWAIT, /* Graceful close wait draining remaining bytes .*/ + SOCK_CLOSED, /* Socket has been closed. */ SOCK_DROPPED, /* Client dropped connection. */ SOCK_TIMEOUT, /* Request timeout waiting to be queued. */ *************** *** 57,60 **** --- 60,64 ---- char *states[] = { + "accept", "readwait", "preque", *************** *** 62,66 **** --- 66,72 ---- "runwait", "running", + "closereq", "closewait", + "closed", "dropped", "timeout", *************** *** 89,92 **** --- 95,100 ---- E_RRANGE, E_CRANGE, + E_FILTER, + E_QUEWAIT, } ReadErr; *************** *** 155,164 **** static void FreeConn(Conn *connPtr); static int RunQueWaits(PollData *pdataPtr, Ns_Time *nowPtr, Sock *sockPtr); static void ThreadName(Driver *drvPtr, char *name); static void SockWait(Sock *sockPtr, Ns_Time *nowPtr, int timeout, Sock **listPtrPtr); static void AppendConn(Driver *drvPtr, Conn *connPtr); #define SockPush(s, sp) ((s)->nextPtr = *(sp), *(sp) = (s)) ! static void LogReadError(Sock *sockPtr, ReadErr err); /* --- 163,174 ---- static void FreeConn(Conn *connPtr); static int RunQueWaits(PollData *pdataPtr, Ns_Time *nowPtr, Sock *sockPtr); + static int RunFilters(Conn *connPtr, int why); static void ThreadName(Driver *drvPtr, char *name); + static void SockState(Sock *sockPtr, int state); static void SockWait(Sock *sockPtr, Ns_Time *nowPtr, int timeout, Sock **listPtrPtr); static void AppendConn(Driver *drvPtr, Conn *connPtr); #define SockPush(s, sp) ((s)->nextPtr = *(sp), *(sp) = (s)) ! static void LogReadError(Conn *connPtr, ReadErr err); /* *************** *** 171,174 **** --- 181,185 ---- static Tcl_HashTable hosts; /* Host header to server table. */ static ServerMap *defMapPtr;/* Default server when not found in table. */ + static Ns_Tls drvtls; *************** *** 194,197 **** --- 205,209 ---- Ns_MutexSetName(&connlock, "ns:conns"); Tcl_InitHashTable(&hosts, TCL_STRING_KEYS); + Ns_TlsAlloc(&drvtls, NULL); } *************** *** 539,543 **** * * Results: ! * None. * * Side effects: --- 551,555 ---- * * Results: ! * NS_OK if registered, NS_ERROR otherwise. * * Side effects: *************** *** 550,554 **** */ ! void Ns_QueueWait(Ns_Conn *conn, SOCKET sock, Ns_QueueWaitProc *proc, void *arg, int when, Ns_Time *timePtr) --- 562,566 ---- */ ! int Ns_QueueWait(Ns_Conn *conn, SOCKET sock, Ns_QueueWaitProc *proc, void *arg, int when, Ns_Time *timePtr) *************** *** 556,560 **** --- 568,578 ---- Conn *connPtr = (Conn *) conn; QueWait *queWaitPtr; + Driver *drvPtr; + drvPtr = Ns_TlsGet(&drvtls); + if (connPtr->sockPtr == NULL || connPtr->sockPtr->drvPtr != Ns_TlsGet(&drvtls)) { + LogReadError(connPtr, E_QUEWAIT); + return NS_ERROR; + } queWaitPtr = ns_malloc(sizeof(QueWait)); queWaitPtr->proc = proc; *************** *** 571,574 **** --- 589,593 ---- connPtr->queWaitPtr = queWaitPtr; queWaitPtr->timeout = *timePtr; + return NS_OK; } *************** *** 830,833 **** --- 849,862 ---- /* + * Defer the close if not requested from a connection thread + * which could happen in a read or pre-queue callback. + */ + + if (sockPtr->state != SOCK_RUNNING) { + SockState(sockPtr, SOCK_CLOSEREQ); + return; + } + + /* * If keepalive is requested and enabled, set the read wait * state. Otherwise, set close wait which simply drains any *************** *** 837,843 **** if (keep && drvPtr->keepwait > 0 && (*drvPtr->proc)(DriverKeep, sock, NULL, 0) == 0) { ! sockPtr->state = SOCK_READWAIT; } else { ! sockPtr->state = SOCK_CLOSEWAIT; } Ns_MutexLock(&drvPtr->lock); --- 866,872 ---- if (keep && drvPtr->keepwait > 0 && (*drvPtr->proc)(DriverKeep, sock, NULL, 0) == 0) { ! SockState(sockPtr, SOCK_READWAIT); } else { ! SockState(sockPtr, SOCK_CLOSEWAIT); } Ns_MutexLock(&drvPtr->lock); *************** *** 921,924 **** --- 950,954 ---- Sock *queSockPtr = NULL; /* Sock's ready to queue. */ + Ns_TlsSet(&drvtls, drvPtr); ThreadName(drvPtr, "driver"); *************** *** 1046,1050 **** if ((sockPtr = connPtr->sockPtr) != NULL) { connPtr->sockPtr = NULL; ! sockPtr->state = SOCK_CLOSEWAIT; SockPush(sockPtr, &closePtr); } --- 1076,1080 ---- if ((sockPtr = connPtr->sockPtr) != NULL) { connPtr->sockPtr = NULL; ! SockState(sockPtr, SOCK_CLOSEWAIT); SockPush(sockPtr, &closePtr); } *************** *** 1185,1189 **** /* ! * Process sockets ready to run, starting with pre-queue callbacks. */ --- 1215,1219 ---- /* ! * Process sockets ready to run. */ *************** *** 1191,1217 **** preqSockPtr = sockPtr->nextPtr; sockPtr->connPtr->times.ready = now; ! if (sockPtr->state != SOCK_PREQUE || ! NsRunFilters((Ns_Conn *) sockPtr->connPtr, ! NS_FILTER_PRE_QUEUE) != NS_OK) { SockClose(sockPtr); } else if (sockPtr->connPtr->queWaitPtr != NULL) { ! /* NB: Sock timeout ignored during que wait. */ ! sockPtr->state = SOCK_QUEWAIT; ! SockPush(sockPtr, &waitPtr); } else { ! SockPush(sockPtr, &queSockPtr); } } /* ! * Add Sock's now ready to the queue. */ while ((sockPtr = queSockPtr) != NULL) { queSockPtr = sockPtr->nextPtr; ! connPtr = sockPtr->connPtr; ! sockPtr->timeout = connPtr->times.queue = now; ! Ns_IncrTime(&sockPtr->timeout, connPtr->limitsPtr->timeout, 0); ! AppendConn(drvPtr, connPtr); } --- 1221,1263 ---- preqSockPtr = sockPtr->nextPtr; sockPtr->connPtr->times.ready = now; ! /* ! * Invoke any pre-queue filters ! */ ! ! if (sockPtr->state == SOCK_PREQUE ! && !RunFilters(sockPtr->connPtr, NS_FILTER_PRE_QUEUE)) { ! if (sockPtr->state != SOCK_CLOSEREQ) { ! SockState(sockPtr, SOCK_ERROR); ! } ! } ! if (sockPtr->state != SOCK_PREQUE) { ! /* NB: Should be one of SOCK_ERROR or SOCK_CLOSEREQ. */ SockClose(sockPtr); } else if (sockPtr->connPtr->queWaitPtr != NULL) { ! /* NB: Sock timeout ignored during que wait. */ ! SockState(sockPtr, SOCK_QUEWAIT); ! SockPush(sockPtr, &waitPtr); } else { ! SockPush(sockPtr, &queSockPtr); } } /* ! * Add Sock's now ready to queue, freeing any connection ! * interp which may have been allocated for que-wait callbacks ! * and/or pre-queue filters. */ while ((sockPtr = queSockPtr) != NULL) { queSockPtr = sockPtr->nextPtr; ! connPtr = sockPtr->connPtr; ! NsFreeConnInterp(connPtr); ! if (sockPtr->state == SOCK_ERROR) { ! SockClose(sockPtr); ! } else { ! sockPtr->timeout = connPtr->times.queue = now; ! Ns_IncrTime(&sockPtr->timeout, connPtr->limitsPtr->timeout, 0); ! AppendConn(drvPtr, connPtr); ! } } *************** *** 1231,1235 **** if (PollIn(&pdata, sockPtr->pidx)) { ++drvPtr->stats.dropped; ! sockPtr->state = SOCK_DROPPED; goto dropped; } --- 1277,1281 ---- if (PollIn(&pdata, sockPtr->pidx)) { ++drvPtr->stats.dropped; ! SockState(sockPtr, SOCK_DROPPED); goto dropped; } *************** *** 1237,1252 **** if (limitsPtr->nrunning < limitsPtr->maxrun) { ++limitsPtr->nrunning; ! sockPtr->state = SOCK_RUNNING; } else if (Ns_DiffTime(&sockPtr->timeout, &now, NULL) <= 0) { ++limitsPtr->ntimeout; ++drvPtr->stats.timeout; ! sockPtr->state = SOCK_TIMEOUT; } else if (limitsPtr->nwaiting < limitsPtr->maxwait) { ++limitsPtr->nwaiting; ! sockPtr->state = SOCK_RUNWAIT; } else { ++limitsPtr->noverflow; ++drvPtr->stats.overflow; ! sockPtr->state = SOCK_OVERFLOW; } dropped: --- 1283,1298 ---- if (limitsPtr->nrunning < limitsPtr->maxrun) { ++limitsPtr->nrunning; ! SockState(sockPtr, SOCK_RUNNING); } else if (Ns_DiffTime(&sockPtr->timeout, &now, NULL) <= 0) { ++limitsPtr->ntimeout; ++drvPtr->stats.timeout; ! SockState(sockPtr, SOCK_TIMEOUT); } else if (limitsPtr->nwaiting < limitsPtr->maxwait) { ++limitsPtr->nwaiting; ! SockState(sockPtr, SOCK_RUNWAIT); } else { ++limitsPtr->noverflow; ++drvPtr->stats.overflow; ! SockState(sockPtr, SOCK_OVERFLOW); } dropped: *************** *** 1420,1423 **** --- 1466,1496 ---- *---------------------------------------------------------------------- * + * SockState -- + * + * Set the socket state. + * + * Results: + * None. + * + * Side effects: + * Updates sockPtr->state. + * + *---------------------------------------------------------------------- + */ + + static void + SockState(Sock *sockPtr, int state) + { + if (sockPtr->drvPtr->flags & DRIVER_DEBUG) { + Ns_Log(Notice, "%s[%d]: %s -> %s\n", sockPtr->drvPtr->name, + sockPtr->sock, states[sockPtr->state], states[state]); + } + sockPtr->state = state; + } + + + /* + *---------------------------------------------------------------------- + * * SockWait -- * *************** *** 1505,1509 **** sockPtr->id = drvPtr->nextid++; sockPtr->drvPtr = drvPtr; ! sockPtr->state = SOCK_READWAIT; sockPtr->arg = NULL; sockPtr->connPtr = NULL; --- 1578,1583 ---- sockPtr->id = drvPtr->nextid++; sockPtr->drvPtr = drvPtr; ! sockPtr->state = SOCK_ACCEPT; ! SockState(sockPtr, SOCK_READWAIT); sockPtr->arg = NULL; sockPtr->connPtr = NULL; *************** *** 1563,1566 **** --- 1637,1641 ---- if (sockPtr->connPtr != NULL) { + NsFreeConnInterp(sockPtr->connPtr); FreeConn(sockPtr->connPtr); sockPtr->connPtr = NULL; *************** *** 1569,1572 **** --- 1644,1648 ---- (void) (*drvPtr->proc)(DriverClose, (Ns_Sock *) sockPtr, NULL, 0); ns_sockclose(sockPtr->sock); + SockState(sockPtr, SOCK_CLOSED); sockPtr->sock = INVALID_SOCKET; drvPtr->stats.reads += sockPtr->nreads; *************** *** 1633,1637 **** ReadErr err; ! //errno = 0; ++sockPtr->nreads; if ((connPtr->flags & NS_CONN_READHDRS)) { --- 1709,1716 ---- ReadErr err; ! /* ! * Read any waiting request+headers and/or content. ! */ ! ++sockPtr->nreads; if ((connPtr->flags & NS_CONN_READHDRS)) { *************** *** 1642,1667 **** /* ! * Mark the connection ready if all input received, truncating any ! * extra \r\n and rewinding the input. */ ! if (!err ! && (connPtr->flags & NS_CONN_READHDRS) ! && connPtr->avail >= (size_t) connPtr->contentLength) { ! connPtr->avail = connPtr->contentLength; ! if (!(connPtr->flags & NS_CONN_FILECONTENT)) { ! connPtr->content[connPtr->avail] = '\0'; ! } else if (ftruncate(connPtr->tfd, connPtr->avail) != 0) { ! err = E_FDTRUNC; ! } else if (lseek(connPtr->tfd, (off_t) 0, SEEK_SET) != 0) { ! err = E_FDSEEK; ! } ! if (!err) { ! sockPtr->state = SOCK_PREQUE; } } if (err) { ! LogReadError(sockPtr, err); ! sockPtr->state = SOCK_ERROR; } } --- 1721,1754 ---- /* ! * If the request+headers have been received, check that all content ! * has been received (truncating any extra \r\n and rewinding ! * file-based content) and/or invoke read filter callbacks. */ ! if (!err && (connPtr->flags & NS_CONN_READHDRS)) { ! if (!RunFilters(connPtr, NS_FILTER_READ)) { ! err = E_FILTER; ! } else if (connPtr->avail >= (size_t) connPtr->contentLength) { ! connPtr->avail = connPtr->contentLength; ! if (!(connPtr->flags & NS_CONN_FILECONTENT)) { ! connPtr->content[connPtr->avail] = '\0'; ! } else { ! if (ftruncate(connPtr->tfd, connPtr->avail) != 0) { ! err = E_FDTRUNC; ! } else if (lseek(connPtr->tfd, (off_t) 0, SEEK_SET) != 0) { ! err = E_FDSEEK; ! } ! } ! if (!err) { ! SockState(sockPtr, SOCK_PREQUE); ! } } } + if (err) { ! if (sockPtr->state != SOCK_CLOSEREQ) { ! SockState(sockPtr, SOCK_ERROR); ! } ! LogReadError(connPtr, err); } } *************** *** 2132,2137 **** AllocConn(Driver *drvPtr, Ns_Time *nowPtr, Sock *sockPtr) { - Conn *connPtr; static unsigned int nextid = 0; int id; --- 2219,2224 ---- AllocConn(Driver *drvPtr, Ns_Time *nowPtr, Sock *sockPtr) { static unsigned int nextid = 0; + Conn *connPtr; int id; *************** *** 2156,2159 **** --- 2243,2247 ---- connPtr->tfd = -1; connPtr->headers = Ns_SetCreate(NULL); + connPtr->outputheaders = Ns_SetCreate(NULL); Tcl_InitHashTable(&connPtr->files, TCL_STRING_KEYS); connPtr->drvPtr = drvPtr; *************** *** 2165,2168 **** --- 2253,2257 ---- connPtr->times.accept = sockPtr->acceptTime; connPtr->sockPtr = sockPtr; + return connPtr; } *************** *** 2201,2204 **** --- 2290,2299 ---- */ + if (connPtr->type != NULL) { + Ns_ConnSetType(conn, NULL); + } + if (connPtr->query != NULL) { + Ns_ConnClearQuery(conn); + } if (conn->request != NULL) { Ns_FreeRequest(conn->request); *************** *** 2214,2217 **** --- 2309,2313 ---- } Ns_SetFree(connPtr->headers); + Ns_SetFree(connPtr->outputheaders); /* *************** *** 2221,2224 **** --- 2317,2321 ---- */ + Ns_DStringTrunc(&connPtr->obuf, 0); Ns_DStringTrunc(&connPtr->ibuf, 0); zlen = (size_t) ((char *) &connPtr->ibuf - (char *) connPtr); *************** *** 2235,2238 **** --- 2332,2361 ---- *---------------------------------------------------------------------- * + * RunPreQueues -- + * + * Execute any pre-queue callbacks, freeing any allocated interp. + * + * Results: + * 1 if ok, 0 otherwise. + * + * Side effects: + * Depends on callbacks, if any. + * + *---------------------------------------------------------------------- + */ + + static int + RunFilters(Conn *connPtr, int why) + { + int status; + + status = NsRunFilters((Ns_Conn *) connPtr, why); + return (status == NS_OK ? 1 : 0); + } + + + /* + *---------------------------------------------------------------------- + * * ReaderThread -- * *************** *** 2281,2287 **** /* ! * Return the connection to the driver thread. */ Ns_MutexLock(&drvPtr->lock); sockPtr->nextPtr = drvPtr->runSockPtr; --- 2404,2413 ---- /* ! * Return the connection to the driver thread, freeing ! * any connection interp which may have been allocated ! * by read filter callbacks. */ + NsFreeConnInterp(sockPtr->connPtr); Ns_MutexLock(&drvPtr->lock); sockPtr->nextPtr = drvPtr->runSockPtr; *************** *** 2341,2346 **** static void ! LogReadError(Sock *sockPtr, ReadErr err) { char *msg, *fmt; --- 2467,2473 ---- static void ! LogReadError(Conn *connPtr, ReadErr err) { + Sock *sockPtr = connPtr->sockPtr; char *msg, *fmt; *************** *** 2394,2397 **** --- 2521,2530 ---- msg = "max content exceeded"; break; + case E_FILTER: + msg = "filter error or abort result"; + break; + case E_QUEWAIT: + msg = "attempt to register quewait outside driver thread"; + break; default: msg = "unknown error"; *************** *** 2408,2411 **** break; } ! Ns_Log(Error, fmt, sockPtr->connPtr->id, msg, strerror(errno)); } --- 2541,2544 ---- break; } ! Ns_Log(Error, fmt, connPtr->id, msg, strerror(errno)); } Index: queue.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/queue.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** queue.c 27 Dec 2008 00:36:38 -0000 1.46 --- queue.c 8 Dec 2009 04:12:19 -0000 1.47 *************** *** 38,41 **** --- 38,42 ---- #include "nsd.h" + #include <math.h> /* *************** *** 558,571 **** ConnRun(Conn *connPtr) { Ns_Conn *conn = (Ns_Conn *) connPtr; NsServer *servPtr = connPtr->servPtr; ! int i, status; ! Tcl_Encoding encoding = NULL; /* ! * Initialize the connection encodings and headers. */ - connPtr->outputheaders = Ns_SetCreate(NULL); encoding = NsGetInputEncoding(connPtr); if (encoding == NULL) { --- 559,571 ---- ConnRun(Conn *connPtr) { + Tcl_Encoding encoding = NULL; Ns_Conn *conn = (Ns_Conn *) connPtr; NsServer *servPtr = connPtr->servPtr; ! int i, status; /* ! * Initialize the connection encodings. */ encoding = NsGetInputEncoding(connPtr); if (encoding == NULL) { *************** *** 575,582 **** } } ! Ns_ConnSetUrlEncoding(conn, encoding); ! if (servPtr->opts.hdrcase != Preserve) { for (i = 0; i < Ns_SetSize(connPtr->headers); ++i) { ! if (servPtr->opts.hdrcase == ToLower) { Ns_StrToLower(Ns_SetKey(connPtr->headers, i)); } else { --- 575,582 ---- } } ! Ns_ConnSetUrlEncoding((Ns_Conn *) connPtr, encoding); ! if (connPtr->servPtr->opts.hdrcase != Preserve) { for (i = 0; i < Ns_SetSize(connPtr->headers); ++i) { ! if (connPtr->servPtr->opts.hdrcase == ToLower) { Ns_StrToLower(Ns_SetKey(connPtr->headers, i)); } else { *************** *** 645,659 **** NsRunCleanups(conn); NsFreeConnInterp(connPtr); - if (connPtr->type != NULL) { - Ns_ConnSetType(conn, NULL); - } - if (connPtr->query != NULL) { - Ns_ConnClearQuery(conn); - } - if (connPtr->outputheaders != NULL) { - Ns_SetFree(connPtr->outputheaders); - connPtr->outputheaders = NULL; - } - Ns_DStringTrunc(&connPtr->obuf, 0); } --- 645,648 ---- Index: tclcmds.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/tclcmds.c,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** tclcmds.c 26 Jun 2006 00:28:02 -0000 1.56 --- tclcmds.c 8 Dec 2009 04:12:19 -0000 1.57 *************** *** 74,77 **** --- 74,78 ---- NsTclChanObjCmd, NsTclChmodObjCmd, + NsTclClsObjCmd, NsTclCondObjCmd, NsTclConnObjCmd, *************** *** 127,130 **** --- 128,132 ---- NsTclPoolsObjCmd, NsTclPurgeFilesObjCmd, + NsTclQueWaitObjCmd, NsTclRWLockObjCmd, NsTclRandObjCmd, *************** *** 171,174 **** --- 173,177 ---- NsTclThreadObjCmd, NsTclTimeObjCmd, + NsTclTlsObjCmd, NsTclTmpNamObjCmd, NsTclTruncateObjCmd, *************** *** 294,297 **** --- 297,301 ---- {"ns_checkurl", NULL, NsTclRequestAuthorizeObjCmd}, {"ns_chmod", NULL, NsTclChmodObjCmd}, + {"ns_cls", NULL, NsTclClsObjCmd}, {"ns_cond", NULL, NsTclCondObjCmd}, {"ns_config", NsTclConfigCmd, NULL}, *************** *** 350,353 **** --- 354,358 ---- {"ns_purgefiles", NULL, NsTclPurgeFilesObjCmd}, {"ns_puts", NULL, NsTclAdpPutsObjCmd}, + {"ns_quewait", NULL, NsTclQueWaitObjCmd}, {"ns_quotehtml", NsTclQuoteHtmlCmd, NULL}, {"ns_rand", NULL, NsTclRandObjCmd}, *************** *** 401,404 **** --- 406,410 ---- {"ns_thread", NULL, NsTclThreadObjCmd}, {"ns_time", NULL, NsTclTimeObjCmd}, + {"ns_tls", NULL, NsTclTlsObjCmd}, {"ns_tmpnam", NULL, NsTclTmpNamObjCmd}, {"ns_truncate", NULL, NsTclTruncateObjCmd}, Index: tclrequest.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/tclrequest.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tclrequest.c 23 Aug 2005 22:05:04 -0000 1.13 --- tclrequest.c 8 Dec 2009 04:12:19 -0000 1.14 *************** *** 258,265 **** int when, i; static CONST char *wopt[] = { ! "prequeue", "preauth", "postauth", "trace", NULL }; enum { ! PQIdx, PRIdx, POIdx, TRIdx, } widx; --- 258,265 ---- int when, i; static CONST char *wopt[] = { ! "read", "write", "prequeue", "preauth", "postauth", "trace", NULL }; enum { ! ReadIdx, WriteIdx, PreQueueIdx, PreAuthIdx, PostAuthIdx, TraceIdx, } widx; *************** *** 282,295 **** } switch (widx) { ! case PQIdx: when |= NS_FILTER_PRE_QUEUE; break; ! case PRIdx: when |= NS_FILTER_PRE_AUTH; break; ! case POIdx: when |= NS_FILTER_POST_AUTH; break; ! case TRIdx: when |= NS_FILTER_TRACE; break; --- 282,301 ---- } switch (widx) { ! case ReadIdx: ! when |= NS_FILTER_READ; ! break; ! case WriteIdx: ! when |= NS_FILTER_WRITE; ! break; ! case PreQueueIdx: when |= NS_FILTER_PRE_QUEUE; break; ! case PreAuthIdx: when |= NS_FILTER_PRE_AUTH; break; ! case PostAuthIdx: when |= NS_FILTER_POST_AUTH; break; ! case TraceIdx: when |= NS_FILTER_TRACE; break; *************** *** 505,508 **** --- 511,523 ---- } switch (why) { + case NS_FILTER_READ: + Tcl_DStringAppendElement(&script, "read"); + break; + case NS_FILTER_WRITE: + Tcl_DStringAppendElement(&script, "write"); + break; + case NS_FILTER_PRE_QUEUE: + Tcl_DStringAppendElement(&script, "prequeue"); + break; case NS_FILTER_PRE_AUTH: Tcl_DStringAppendElement(&script, "preauth"); Index: tclsock.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/tclsock.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tclsock.c 2 Aug 2005 22:11:58 -0000 1.24 --- tclsock.c 8 Dec 2009 04:12:19 -0000 1.25 *************** *** 28,32 **** */ - /* * tclsock.c -- --- 28,31 ---- *************** *** 73,76 **** --- 72,76 ---- Tcl_Obj *CONST objv[]); static Ns_SockProc SockListenCallback; + static Ns_QueueWaitProc WaitCallback; void *************** *** 86,89 **** --- 86,164 ---- *---------------------------------------------------------------------- * + * NsTclQueWaitObjCmd -- + * + * Implement the ns_quewait command to register a Tcl script + * Ns_QueueWait callback. Unlike the general ns_sockcallback, + * the script will execute later in the same, connection-bound + * interp which calls ns_quewait. Thus the interface is + * closer to Tcl's standard "fileevent" command. + * + * Results: + * Tcl result. + * + * Side effects: + * Depends on callbacks. + * + *---------------------------------------------------------------------- + */ + + int + NsTclQueWaitObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) + { + TclSockCallback *cbPtr; + Ns_Conn *conn; + Tcl_Channel chan; + SOCKET sock; + int when; + Ns_Time timeout; + static CONST char *opt[] = { + "readable", "writable", NULL + }; + enum { + ReadIdx, WriteIdx + } idx; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 1, objv, "sockId event timeout script"); + return TCL_ERROR; + } + if (NsTclGetConn((NsInterp *) arg, &conn) != TCL_OK) { + return TCL_ERROR; + } + chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL); + if (chan == NULL) { + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(interp, objv[2], opt, "event", 0, + (int *) &idx) != TCL_OK) { + return TCL_ERROR; + } + switch (idx) { + case ReadIdx: + when = NS_SOCK_READ; + break; + case WriteIdx: + when = NS_SOCK_WRITE; + break; + } + if (Ns_TclGetOpenFd(interp, Tcl_GetString(objv[1]), + (idx == WriteIdx) ? 1 :0, (int *) &sock) != TCL_OK) { + return TCL_ERROR; + } + if (Ns_TclGetTimeFromObj(interp, objv[3], &timeout) != TCL_OK) { + return TCL_ERROR; + } + if (Ns_QueueWait(conn, sock, WaitCallback, objv[4], when, &timeout) != NS_OK) { + Tcl_SetResult(interp, "could not register sock wait", TCL_STATIC); + return TCL_ERROR; + } + Tcl_IncrRefCount(objv[4]); + return TCL_OK; + } + + + /* + *---------------------------------------------------------------------- + * * NsTclGetHostObjCmd, NsTclGetAddrObjCmd -- * *************** *** 1135,1138 **** --- 1210,1268 ---- *---------------------------------------------------------------------- * + * WaitCallback -- + * + * This is the C wrapper Ns_QueueWait callback registered in + * ns_quewait. + * + * Results: + * None. + * + * Side effects: + * Will run Tcl script. + * + *---------------------------------------------------------------------- + */ + + static void + WaitCallback(Ns_Conn *conn, SOCKET sock, void *arg, int why) + { + Tcl_Interp *interp = Ns_GetConnInterp(conn); + Tcl_Obj *objPtr = arg; + Tcl_DString ds; + char *s; + int len; + + Tcl_DStringInit(&ds); + s = Tcl_GetStringFromObj(objPtr, &len); + Tcl_DStringAppend(&ds, s, len); + + /* + * NB: While the C interface allows for a single callback + * to be registered (NS_SOCK_READ | NS_SOCK_WRITE), the + * ns_quewait command enforces only readable or writable + * at a time. + */ + + if (why == 0) { + s = "timeout"; + } else if (why & NS_SOCK_READ) { + s = "readable"; + } else if (why & NS_SOCK_WRITE) { + s = "writable"; + } else if (why & NS_SOCK_DROP) { + s = "dropped"; + } + Tcl_DStringAppendElement(&ds, s); + if (Tcl_EvalEx(interp, ds.string, ds.length, 0) != TCL_OK) { + Ns_TclLogError(interp); + } + Tcl_DStringFree(&ds); + Tcl_DecrRefCount(objPtr); + } + + + /* + *---------------------------------------------------------------------- + * * SockListenCallback -- * |
|
From: <jgd...@us...> - 2009-12-08 04:11:07
|
Update of /cvsroot/aolserver/aolserver/include In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9518/include Modified Files: ns.h Log Message: Changed definition of Ns_QueueWait, added NS_FILTER_READ and NS_FILTER_WRITE constants and definition for new Ns_ConnContentAvail. Index: ns.h =================================================================== RCS file: /cvsroot/aolserver/aolserver/include/ns.h,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** ns.h 1 Feb 2009 17:45:34 -0000 1.88 --- ns.h 8 Dec 2009 04:10:56 -0000 1.89 *************** *** 104,107 **** --- 104,109 ---- #define NS_FILTER_VOID_TRACE 8 #define NS_FILTER_PRE_QUEUE 16 + #define NS_FILTER_READ 32 + #define NS_FILTER_WRITE 64 #define NS_REGISTER_SERVER_TRACE 16 #define NS_OP_NOINHERIT 2 *************** *** 656,659 **** --- 658,662 ---- NS_EXTERN char *Ns_ConnAuthPasswd(Ns_Conn *conn); NS_EXTERN int Ns_ConnContentLength(Ns_Conn *conn); + NS_EXTERN int Ns_ConnContentAvail(Ns_Conn *conn); NS_EXTERN char *Ns_ConnContent(Ns_Conn *conn); NS_EXTERN char *Ns_ConnServer(Ns_Conn *conn); *************** *** 698,702 **** NS_EXTERN int Ns_DriverInit(char *server, char *module, Ns_DriverInitData *init); ! NS_EXTERN void Ns_QueueWait(Ns_Conn *conn, SOCKET sock, Ns_QueueWaitProc *proc, void *arg, int when, Ns_Time *timePtr); --- 701,705 ---- NS_EXTERN int Ns_DriverInit(char *server, char *module, Ns_DriverInitData *init); ! NS_EXTERN int Ns_QueueWait(Ns_Conn *conn, SOCKET sock, Ns_QueueWaitProc *proc, void *arg, int when, Ns_Time *timePtr); |
|
From: <gne...@us...> - 2009-05-15 08:31:44
|
Update of /cvsroot/aolserver/aolserver/nsd In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29416/nsd Modified Files: pools.c Log Message: - Allowing maxconns to be set to 0 Index: pools.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/pools.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pools.c 31 Jan 2009 21:23:47 -0000 1.15 --- pools.c 15 May 2009 08:31:27 -0000 1.16 *************** *** 202,207 **** return TCL_ERROR; } ! if (poolPtr->threads.maxconns < 1) { ! Tcl_SetResult(interp, "maxconns cannot be less than 1", TCL_STATIC); return TCL_ERROR; } --- 202,207 ---- return TCL_ERROR; } ! if (poolPtr->threads.maxconns < 0) { ! Tcl_SetResult(interp, "maxconns cannot be less than 0", TCL_STATIC); return TCL_ERROR; } |
|
From: <gne...@us...> - 2009-05-15 08:31:38
|
Update of /cvsroot/aolserver/aolserver In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29416 Modified Files: ChangeLog Log Message: - Allowing maxconns to be set to 0 Index: ChangeLog =================================================================== RCS file: /cvsroot/aolserver/aolserver/ChangeLog,v retrieving revision 1.392 retrieving revision 1.393 diff -C2 -d -r1.392 -r1.393 *** ChangeLog 14 May 2009 06:51:15 -0000 1.392 --- ChangeLog 15 May 2009 08:31:27 -0000 1.393 *************** *** 1,2 **** --- 1,7 ---- + 2009-05-15 Gustaf Neumann <ne...@wu...> + + * nsd/pools.c: + Allowing maxconns to be set to 0 + 2009-05-14 Gustaf Neumann <ne...@wu...> |
|
From: <gne...@us...> - 2009-05-14 06:51:30
|
Update of /cvsroot/aolserver/aolserver In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15744 Modified Files: ChangeLog Log Message: - fix typo in tcl/stats.tcl Index: ChangeLog =================================================================== RCS file: /cvsroot/aolserver/aolserver/ChangeLog,v retrieving revision 1.391 retrieving revision 1.392 diff -C2 -d -r1.391 -r1.392 *** ChangeLog 14 May 2009 04:27:03 -0000 1.391 --- ChangeLog 14 May 2009 06:51:15 -0000 1.392 *************** *** 1,9 **** 2009-05-14 Gustaf Neumann <ne...@wu...> ! * nsd/httptime.c Made output of ns_httptime independent of locale setting. The change is based on a patch of Alexey Pechnikov, fixing an incorrect patch in the debian source tree. 2009-03-08 Gustaf Neumann <ne...@wu...> * Fix of two bugs with nsproxy: --- 1,12 ---- 2009-05-14 Gustaf Neumann <ne...@wu...> ! * nsd/httptime.c: Made output of ns_httptime independent of locale setting. The change is based on a patch of Alexey Pechnikov, fixing an incorrect patch in the debian source tree. + * tcl/stats.tcl: + Fix typo + 2009-03-08 Gustaf Neumann <ne...@wu...> * Fix of two bugs with nsproxy: |
|
From: <gne...@us...> - 2009-05-14 06:51:24
|
Update of /cvsroot/aolserver/aolserver/tcl In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15744/tcl Modified Files: stats.tcl Log Message: - fix typo in tcl/stats.tcl Index: stats.tcl =================================================================== RCS file: /cvsroot/aolserver/aolserver/tcl/stats.tcl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** stats.tcl 12 Oct 2008 09:00:34 -0000 1.4 --- stats.tcl 14 May 2009 06:51:16 -0000 1.5 *************** *** 117,121 **** o <a href=$baseUrl/mempools.adp>Memory</a><br> o <a href=$baseUrl/process.adp>Process</a><br> ! o <a href=$baseUrl/sched.adp>Scheduled Proceedures</a><br> o <a href=$baseUrl/threads.adp>Threads</a><br>" --- 117,121 ---- o <a href=$baseUrl/mempools.adp>Memory</a><br> o <a href=$baseUrl/process.adp>Process</a><br> ! o <a href=$baseUrl/sched.adp>Scheduled Procedures</a><br> o <a href=$baseUrl/threads.adp>Threads</a><br>" *************** *** 504,508 **** set colTitles [list ID Status Callback Data Flags "Last Queue" "Last Start" "Last End" Duration "Next Run"] ! set html [_ns_stats.header "Scheduled Proceedures"] append html [_ns_stats.results $col $colTitles sched.adp $rows $reverseSort] append html [_ns_stats.footer] --- 504,508 ---- set colTitles [list ID Status Callback Data Flags "Last Queue" "Last Start" "Last End" Duration "Next Run"] ! set html [_ns_stats.header "Scheduled Procedures"] append html [_ns_stats.results $col $colTitles sched.adp $rows $reverseSort] append html [_ns_stats.footer] |
|
From: <gne...@us...> - 2009-05-14 04:27:15
|
Update of /cvsroot/aolserver/aolserver In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv5517 Modified Files: ChangeLog Log Message: - Made output of ns_httptime independent of locale setting. Index: ChangeLog =================================================================== RCS file: /cvsroot/aolserver/aolserver/ChangeLog,v retrieving revision 1.390 retrieving revision 1.391 diff -C2 -d -r1.390 -r1.391 *** ChangeLog 8 Mar 2009 11:39:01 -0000 1.390 --- ChangeLog 14 May 2009 04:27:03 -0000 1.391 *************** *** 1,2 **** --- 1,9 ---- + 2009-05-14 Gustaf Neumann <ne...@wu...> + + * nsd/httptime.c + Made output of ns_httptime independent of locale setting. + The change is based on a patch of Alexey Pechnikov, + fixing an incorrect patch in the debian source tree. + 2009-03-08 Gustaf Neumann <ne...@wu...> * Fix of two bugs with nsproxy: |
|
From: <gne...@us...> - 2009-05-14 04:27:15
|
Update of /cvsroot/aolserver/aolserver/nsd In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv5517/nsd Modified Files: httptime.c Log Message: - Made output of ns_httptime independent of locale setting. Index: httptime.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/httptime.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** httptime.c 18 Jan 2003 19:24:20 -0000 1.9 --- httptime.c 14 May 2009 04:27:05 -0000 1.10 *************** *** 28,32 **** */ - /* * time.c -- --- 28,31 ---- *************** *** 57,60 **** --- 56,64 ---- }; + static char *weekdays_names[7] = + { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + /* *************** *** 93,101 **** /* ! * This will most likely break if the locale is not an english one. * The format is RFC 1123: "Sun, 06 Nov 1997 09:12:45 GMT" */ ! strftime(buf, 40, "%a, %d %b %Y %H:%M:%S GMT", tmPtr); Ns_DStringAppend(pds, buf); --- 97,108 ---- /* ! * Provide always english names independent of locale setting. * The format is RFC 1123: "Sun, 06 Nov 1997 09:12:45 GMT" */ ! snprintf(buf, 40, "%s, %02d %s %04d %02d:%02d:%02d GMT", ! weekdays_names[tmPtr->tm_wday], tmPtr->tm_mday, ! month_names[tmPtr->tm_mon], tmPtr->tm_year + 1900, ! tmPtr->tm_hour, tmPtr->tm_min, tmPtr->tm_sec); Ns_DStringAppend(pds, buf); |
|
From: <gne...@us...> - 2009-03-08 11:39:07
|
Update of /cvsroot/aolserver/aolserver In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20803 Modified Files: ChangeLog Log Message: - document nsproxy fixes in Changelog Index: ChangeLog =================================================================== RCS file: /cvsroot/aolserver/aolserver/ChangeLog,v retrieving revision 1.389 retrieving revision 1.390 diff -C2 -d -r1.389 -r1.390 *** ChangeLog 1 Feb 2009 17:45:34 -0000 1.389 --- ChangeLog 8 Mar 2009 11:39:01 -0000 1.390 *************** *** 1,2 **** --- 1,13 ---- + 2009-03-08 Gustaf Neumann <ne...@wu...> + * Fix of two bugs with nsproxy: + + a) The initialize Tcl to avoid crash with Tcl8.5, when the + nsproxy binary is started (see + http://groups.google.com/group/aolserver/browse_thread/thread/28113c5324a6747e) + + b) Truncate name of proxy_id to avoid buffer overflows, + increase allowed length of proxy name from 16 to 64 (and + provide constant MAX_PROXY_ID_LEN to ease maintenance) + 2009-02-01 Gustaf Neumann <ne...@wu...> |
|
From: <gne...@us...> - 2009-03-08 11:31:21
|
Update of /cvsroot/aolserver/aolserver/nsproxy In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20368 Modified Files: nsproxylib.c Log Message: - truncate name of proxy_id to avoid buffer overflows - increase allowed length of proxy name from 16 to 64 (and provide constant MAX_PROXY_ID_LEN to ease maintenance) Index: nsproxylib.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsproxy/nsproxylib.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** nsproxylib.c 20 Jun 2008 08:06:33 -0000 1.7 --- nsproxylib.c 8 Mar 2009 11:31:12 -0000 1.8 *************** *** 77,80 **** --- 77,81 ---- * from a pool. */ + #define MAX_PROXY_ID_LEN 64 typedef struct Proxy { *************** *** 86,90 **** Done /* Result is pending. */ } state; ! char id[16]; /* Proxy unique string id. */ Proc *procPtr; /* Running child process, if any. */ Tcl_HashEntry *idPtr; /* Pointer to proxy table entry. */ --- 87,91 ---- Done /* Result is pending. */ } state; ! char id[MAX_PROXY_ID_LEN]; /* Proxy unique string id. */ Proc *procPtr; /* Running child process, if any. */ Tcl_HashEntry *idPtr; /* Pointer to proxy table entry. */ *************** *** 194,198 **** static Ns_Cond pcond; static Ns_Mutex plock; ! static Proc *firstClosePtr; static Ns_DString defexec; --- 195,199 ---- static Ns_Cond pcond; static Ns_Mutex plock; ! static Proc *firstClosePtr = NULL; static Ns_DString defexec; *************** *** 836,842 **** poolPtr->firstPtr = proxyPtr->nextPtr; } else { proxyPtr = ns_calloc(1, sizeof(Proxy)); proxyPtr->poolPtr = poolPtr; ! sprintf(proxyPtr->id, "%s-proxy-%d", poolPtr->name, poolPtr->nextid++); Tcl_DStringInit(&proxyPtr->in); } --- 837,856 ---- poolPtr->firstPtr = proxyPtr->nextPtr; } else { + char int_buf[20]; /* same value as in other places */ + proxyPtr = ns_calloc(1, sizeof(Proxy)); proxyPtr->poolPtr = poolPtr; ! ! /* The user provided name is used together with a ! constant string and a running number to the ! proxy id. We have to truncate the name if it ! is too long to prevent buffer overflows; the ! constant part "-proxy-" is 7 characters long */ ! sprintf(int_buf, "%d", poolPtr->nextid++); ! strncat(proxyPtr->id, poolPtr->name, ! MAX_PROXY_ID_LEN - (strlen(int_buf) + 7 + 1)); ! strcat(proxyPtr->id, "-proxy-"); ! strcat(proxyPtr->id, int_buf); ! Tcl_DStringInit(&proxyPtr->in); } |
|
From: <gne...@us...> - 2009-03-08 11:27:15
|
Update of /cvsroot/aolserver/aolserver/nsproxy In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20159 Modified Files: nsproxy.c Log Message: - initialize Tcl to avoid crash with Tcl8.5, when the nsproxy binary is started (see http://groups.google.com/group/aolserver/browse_thread/thread/28113c5324a6747e) Index: nsproxy.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsproxy/nsproxy.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** nsproxy.c 19 Apr 2006 18:55:09 -0000 1.1 --- nsproxy.c 8 Mar 2009 11:26:58 -0000 1.2 *************** *** 43,46 **** --- 43,47 ---- main(int argc, char **argv) { + Tcl_FindExecutable(argv[0]); return Ns_ProxyMain(argc, argv, MyInit); } |
|
From: <gne...@us...> - 2009-02-01 17:45:52
|
Update of /cvsroot/aolserver/aolserver/include In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23321/include Modified Files: ns.h Log Message: bump version number to 4.5.1 Index: ns.h =================================================================== RCS file: /cvsroot/aolserver/aolserver/include/ns.h,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** ns.h 5 Dec 2008 08:51:44 -0000 1.87 --- ns.h 1 Feb 2009 17:45:34 -0000 1.88 *************** *** 42,51 **** #define NS_MAJOR_VERSION 4 #define NS_MINOR_VERSION 5 ! #define NS_RELEASE_SERIAL 0 #define NS_VERSION_NUM (NS_MAJOR_VERSION * 10000 \ + NS_MINOR_VERSION * 100 \ + NS_RELEASE_SERIAL) #define NS_VERSION "4.5" ! #define NS_PATCH_LEVEL "4.5.0p1" #define NS_ALPHA_RELEASE 0 --- 42,51 ---- #define NS_MAJOR_VERSION 4 #define NS_MINOR_VERSION 5 ! #define NS_RELEASE_SERIAL 1 #define NS_VERSION_NUM (NS_MAJOR_VERSION * 10000 \ + NS_MINOR_VERSION * 100 \ + NS_RELEASE_SERIAL) #define NS_VERSION "4.5" ! #define NS_PATCH_LEVEL "4.5.1" #define NS_ALPHA_RELEASE 0 |