You can subscribe to this list here.
2005 |
Jan
|
Feb
(32) |
Mar
(56) |
Apr
(92) |
May
(39) |
Jun
(226) |
Jul
(98) |
Aug
(66) |
Sep
|
Oct
(153) |
Nov
(43) |
Dec
(42) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(97) |
Feb
(141) |
Mar
(147) |
Apr
(80) |
May
(51) |
Jun
(93) |
Jul
(88) |
Aug
(50) |
Sep
(179) |
Oct
(48) |
Nov
(82) |
Dec
(71) |
2007 |
Jan
(42) |
Feb
(46) |
Mar
(123) |
Apr
(21) |
May
(139) |
Jun
(59) |
Jul
(34) |
Aug
(57) |
Sep
(47) |
Oct
(137) |
Nov
(49) |
Dec
(12) |
2008 |
Jan
(10) |
Feb
(8) |
Mar
(63) |
Apr
(17) |
May
(34) |
Jun
(38) |
Jul
(16) |
Aug
(62) |
Sep
(9) |
Oct
(121) |
Nov
(38) |
Dec
(4) |
2009 |
Jan
|
Feb
(11) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(4) |
Apr
(10) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(12) |
2012 |
Jan
(26) |
Feb
(1) |
Mar
(15) |
Apr
(1) |
May
(1) |
Jun
(7) |
Jul
(2) |
Aug
|
Sep
(1) |
Oct
(52) |
Nov
(8) |
Dec
(25) |
2013 |
Jan
(35) |
Feb
(14) |
Mar
(10) |
Apr
(10) |
May
(29) |
Jun
(16) |
Jul
(5) |
Aug
(8) |
Sep
(8) |
Oct
(6) |
Nov
(1) |
Dec
(3) |
2014 |
Jan
(16) |
Feb
(13) |
Mar
(5) |
Apr
(9) |
May
(21) |
Jun
(6) |
Jul
(5) |
Aug
(2) |
Sep
(59) |
Oct
(115) |
Nov
(122) |
Dec
(45) |
2015 |
Jan
(31) |
Feb
(32) |
Mar
(19) |
Apr
(25) |
May
(3) |
Jun
(4) |
Jul
(18) |
Aug
(3) |
Sep
(23) |
Oct
(11) |
Nov
(17) |
Dec
(12) |
2016 |
Jan
(20) |
Feb
(27) |
Mar
(20) |
Apr
(40) |
May
(35) |
Jun
(48) |
Jul
(44) |
Aug
(51) |
Sep
(18) |
Oct
(42) |
Nov
(39) |
Dec
(29) |
2017 |
Jan
(37) |
Feb
(34) |
Mar
(20) |
Apr
(37) |
May
(10) |
Jun
(2) |
Jul
(14) |
Aug
(15) |
Sep
(25) |
Oct
(29) |
Nov
(15) |
Dec
(29) |
2018 |
Jan
(5) |
Feb
(15) |
Mar
(6) |
Apr
(20) |
May
(39) |
Jun
(39) |
Jul
(17) |
Aug
(20) |
Sep
(10) |
Oct
(17) |
Nov
(20) |
Dec
(8) |
2019 |
Jan
(28) |
Feb
(21) |
Mar
(13) |
Apr
(44) |
May
(44) |
Jun
(28) |
Jul
(51) |
Aug
(30) |
Sep
(7) |
Oct
(20) |
Nov
(8) |
Dec
(21) |
2020 |
Jan
(27) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vlad S. <ser...@us...> - 2005-04-02 20:29:55
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25568/nsd Modified Files: tclmisc.c uuencode.c Log Message: modified uuencode/decode to support string buffers any size and be compatible with GNU uuencode, i.e. wrapping lines to be 60 chars Index: tclmisc.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclmisc.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tclmisc.c 6 Mar 2005 22:48:27 -0000 1.2 --- tclmisc.c 2 Apr 2005 20:29:46 -0000 1.3 *************** *** 358,363 **** NsTclHTUUEncodeObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj **objv) { - char bufcoded[1 + (4 * 48) / 2]; char *string; int nbytes; --- 358,363 ---- NsTclHTUUEncodeObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj **objv) { char *string; + char *result; int nbytes; *************** *** 367,377 **** } string = Tcl_GetStringFromObj(objv[1], &nbytes); ! if (nbytes > 48) { ! Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid string \"", ! string, "\": must be less than 48 characters", NULL); ! return TCL_ERROR; ! } ! Ns_HtuuEncode((unsigned char *) string, (size_t)nbytes, bufcoded); ! Tcl_SetResult(interp, bufcoded, TCL_VOLATILE); return TCL_OK; } --- 367,373 ---- } string = Tcl_GetStringFromObj(objv[1], &nbytes); ! result = ns_malloc(1 + (4 * nbytes) / 2); ! Ns_HtuuEncode((unsigned char *) string, (size_t)nbytes, result); ! Tcl_SetResult(interp, result, (Tcl_FreeProc *) ns_free); return TCL_OK; } Index: uuencode.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/uuencode.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** uuencode.c 16 Feb 2005 08:39:33 -0000 1.1.1.1 --- uuencode.c 2 Apr 2005 20:29:46 -0000 1.2 *************** *** 93,97 **** * Side effects: * Encoded characters are placed in output which must be ! * large enough for the result, i.e., (1 + (len * 4) / 3) * bytes. * --- 93,97 ---- * Side effects: * Encoded characters are placed in output which must be ! * large enough for the result, i.e., (1 + (len * 4) / 2) * bytes. * *************** *** 103,107 **** { register unsigned char *p, *q; ! register int n; /* --- 103,107 ---- { register unsigned char *p, *q; ! register int n, line = 0; /* *************** *** 118,121 **** --- 118,130 ---- *q++ = ENC(p[2] & 077); p += 3; + line += 4; + /* + * Add wrapping newline to be compatible with GNU uuencode + */ + + if (line == 60) { + *q++ = '\n'; + line = 0; + } } *************** *** 162,167 **** Ns_HtuuDecode(char *input, unsigned char *output, int outputlen) { register unsigned char *p, *q; - register int len, n; --- 171,177 ---- Ns_HtuuDecode(char *input, unsigned char *output, int outputlen) { + register int n; + unsigned char buf[4]; register unsigned char *p, *q; *************** *** 175,198 **** /* - * Determine the maximum length of output bytes. - */ - - p = input; - while (pr2six[(int)(*p)] >= 0) { - ++p; - } - len = p - (unsigned char *) input; - - /* * Decode every four input bytes. */ p = input; q = output; ! for (n = len / 4; n > 0; --n) { ! *q++ = DEC(p[0]) << 2 | DEC(p[1]) >> 4; ! *q++ = DEC(p[1]) << 4 | DEC(p[2]) >> 2; ! *q++ = DEC(p[2]) << 6 | DEC(p[3]); ! p += 4; } --- 185,205 ---- /* * Decode every four input bytes. */ + n = 0; p = input; q = output; ! while (*p) { ! if (pr2six[(int)(*p)] >= 0) { ! buf[n++] = *p; ! if (n == 4) { ! *q++ = DEC(buf[0]) << 2 | DEC(buf[1]) >> 4; ! *q++ = DEC(buf[1]) << 4 | DEC(buf[2]) >> 2; ! *q++ = DEC(buf[2]) << 6 | DEC(buf[3]); ! n = 0; ! } ! } ! p++; } *************** *** 201,210 **** */ - n = len % 4; if (n > 1) { ! *q++ = DEC(p[0]) << 2 | DEC(p[1]) >> 4; } if (n > 2) { ! *q++ = DEC(p[1]) << 4 | DEC(p[2]) >> 2; } if ((q - output) < outputlen) { --- 208,216 ---- */ if (n > 1) { ! *q++ = DEC(buf[0]) << 2 | DEC(buf[1]) >> 4; } if (n > 2) { ! *q++ = DEC(buf[1]) << 4 | DEC(buf[2]) >> 2; } if ((q - output) < outputlen) { |
From: Vlad S. <ser...@us...> - 2005-04-02 20:29:54
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25568 Modified Files: ChangeLog Log Message: modified uuencode/decode to support string buffers any size and be compatible with GNU uuencode, i.e. wrapping lines to be 60 chars Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ChangeLog 28 Mar 2005 17:02:06 -0000 1.32 --- ChangeLog 2 Apr 2005 20:29:46 -0000 1.33 *************** *** 1,2 **** --- 1,9 ---- + 2005-04-02 Vlad Seryakov <ser...@us...> + + * nsd/tclmisc.c: + * nsd/uuencode.c: modified uuencode/decode to support + string buffers any size and be compatible with GNU uuencode, + i.e. wrapping lines to be 60 chars. + 2005-03-28 Vlad Seryakov <ser...@us...> |
From: Vlad S. <ser...@us...> - 2005-03-28 17:02:58
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7358/nsd Modified Files: filter.c info.c nsd.h op.c urlspace.c Log Message: Added support for ns_info filters, ns_info traces, ns_info requestprocs commands using new Tcl callback interface. New commands show information about registered filters/procs same way as ns_info scheduled does. Closes RFE #1161597. Index: nsd.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsd.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** nsd.h 26 Mar 2005 17:42:26 -0000 1.7 --- nsd.h 28 Mar 2005 17:02:07 -0000 1.8 *************** *** 837,844 **** --- 837,848 ---- extern Ns_OpProc NsTclRequest; extern Ns_OpProc NsAdpRequest; + extern Ns_ArgProc NsTclRequestArgProc; extern void NsGetCallbacks(Tcl_DString *dsPtr); extern void NsGetSockCallbacks(Tcl_DString *dsPtr); extern void NsGetScheduled(Tcl_DString *dsPtr); + extern void NsGetTraces(Tcl_DString *dsPtr, char *server); + extern void NsGetFilters(Tcl_DString *dsPtr, char *server); + extern void NsGetRequestProcs(Tcl_DString *dsPtr, char *server); #ifdef _WIN32 *************** *** 957,960 **** --- 961,966 ---- int *new_type, Tcl_DString *type_ds); + extern void NsUrlSpecificWalk(int id, char *server, Ns_ArgProc func, Tcl_DString *dsPtr); + /* * Proxy support Index: op.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/op.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** op.c 16 Feb 2005 08:39:21 -0000 1.1.1.1 --- op.c 28 Mar 2005 17:02:08 -0000 1.2 *************** *** 467,468 **** --- 467,523 ---- } + /* + *---------------------------------------------------------------------- + * + * NsRequestArgProc -- + * + * Proc info routine to copy Tcl request proc. + * + * Results: + * None. + * + * Side effects: + * Will copy script to given dstring. + * + *---------------------------------------------------------------------- + */ + + void + NsTclRequestArgProc(Tcl_DString *dsPtr, void *arg) + { + Req *reqPtr = arg; + + Ns_GetProcInfo(dsPtr, (void *) reqPtr->proc, reqPtr->arg); + } + + + /* + *---------------------------------------------------------------------- + * NsGetRequestProcs -- + * + * Returns information about registered requests/procs + * + * Results: + * DString with info as Tcl list + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + + void + NsGetRequestProcs(Tcl_DString *dsPtr, char *server) + { + NsServer *servPtr; + + servPtr = NsGetServer(server); + if (servPtr == NULL) { + return; + } + + Ns_MutexLock(&ulock); + NsUrlSpecificWalk(uid, servPtr->server, NsTclRequestArgProc, dsPtr); + Ns_MutexUnlock(&ulock); + } + Index: info.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/info.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** info.c 16 Feb 2005 08:40:00 -0000 1.1.1.1 --- info.c 28 Mar 2005 17:02:07 -0000 1.2 *************** *** 503,507 **** "pid", "platform", "pools", "scheduled", "server", "servers", "sockcallbacks", "tag", "tcllib", "threads", "uptime", ! "version", "winnt", NULL }; enum { --- 503,507 ---- "pid", "platform", "pools", "scheduled", "server", "servers", "sockcallbacks", "tag", "tcllib", "threads", "uptime", ! "version", "winnt", "filters", "traces", "requestprocs", NULL }; enum { *************** *** 511,515 **** IPidIdx, IPlatformIdx, IPoolsIdx, IScheduledIdx, IServerIdx, IServersIdx, sockICallbacksIdx, ITagIdx, ITclLibIdx, IThreadsIdx, IUptimeIdx, ! IVersionIdx, IWinntIdx, } opt; --- 511,515 ---- IPidIdx, IPlatformIdx, IPoolsIdx, IScheduledIdx, IServerIdx, IServersIdx, sockICallbacksIdx, ITagIdx, ITclLibIdx, IThreadsIdx, IUptimeIdx, ! IVersionIdx, IWinntIdx, IFiltersIdx, ITracesIdx, IRequestProcsIdx, } opt; *************** *** 556,559 **** --- 556,574 ---- break; + case IFiltersIdx: + NsGetFilters(&ds, itPtr->servPtr ? itPtr->servPtr->server : 0); + Tcl_DStringResult(interp, &ds); + break; + + case ITracesIdx: + NsGetTraces(&ds, itPtr->servPtr ? itPtr->servPtr->server : 0); + Tcl_DStringResult(interp, &ds); + break; + + case IRequestProcsIdx: + NsGetRequestProcs(&ds, itPtr->servPtr ? itPtr->servPtr->server : 0); + Tcl_DStringResult(interp, &ds); + break; + case ILocksIdx: Ns_MutexList(&ds); Index: urlspace.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/urlspace.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** urlspace.c 16 Feb 2005 08:40:08 -0000 1.1.1.1 --- urlspace.c 28 Mar 2005 17:02:08 -0000 1.2 *************** *** 44,47 **** --- 44,53 ---- /* + * Size of stack to keep track of server/method/url/... node path + */ + + #define STACK_SIZE 512 + + /* * This optimization, when turned on, prevents the server from doing a * whole lot of calls to Tcl_StringMatch on every lookup in urlspace. *************** *** 2090,2091 **** --- 2096,2200 ---- #endif + + + /* + *---------------------------------------------------------------------- + * + * NsUrlSpecificWalk -- + * + * Walk url tree, call ArgProc function for each node + * + * Results: + * None. + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + + static void + WalkTrie(Trie *triePtr, int id, char *server, Ns_ArgProc func, Tcl_DString *dsPtr, char **stack, char *filter) + { + int i, depth; + + for (i = 0; i < (&triePtr->branches)->n; i++) { + Branch *branch; + branch = (Branch *) Ns_IndexEl(&triePtr->branches, i); + + /* + * Remember current stack depth + */ + + for(depth = 0; stack[depth] != NULL && depth < STACK_SIZE-1; depth++) ; + + stack[depth] = branch->word; + WalkTrie(&(branch->node), id, server, func, dsPtr, stack, filter); + + /* + * Restore stack position + */ + + stack[depth] = 0; + } + if (triePtr->indexnode != NULL) { + for (i = 0; i < triePtr->indexnode->n; i++) { + Node *nodePtr; + nodePtr = (Node *) Ns_IndexEl(triePtr->indexnode, i); + if (nodePtr->id == id && !strcmp(server, stack[0])) { + Tcl_DStringStartSublist(dsPtr); + + /* + * Put stack contents into the sublist, + * 1st element is server, 2nd is method, the rest is url + */ + + for (depth = 0; stack[depth] != NULL; depth++) { + switch (depth) { + case 0: + Tcl_DStringAppendElement(dsPtr, stack[depth]); + break; + case 1: + Tcl_DStringAppendElement(dsPtr, stack[depth]); + Tcl_DStringAppend(dsPtr, " ", 1); + break; + default: + Ns_DStringVarAppend(dsPtr, "/", stack[depth], 0); + break; + } + } + Ns_DStringVarAppend(dsPtr, filter, " ", 0); + if (nodePtr->dataInherit != NULL) { + func(dsPtr, nodePtr->dataInherit); + } + if (nodePtr->dataNoInherit != NULL) { + func(dsPtr, nodePtr->dataNoInherit); + } + Tcl_DStringEndSublist(dsPtr); + } + } + } + } + + void + NsUrlSpecificWalk(int id, char *server, Ns_ArgProc func, Tcl_DString *dsPtr) + { + int i; + char *stack[STACK_SIZE]; + + memset(stack, 0, sizeof(stack)); + Ns_MutexLock(&lock); + #ifndef __URLSPACE_OPTIMIZE__ + for (i = 0; i < (&urlspace.byuse)->n; i++) { + Channel *channelPtr; + channelPtr = (Channel *) Ns_IndexEl(&urlspace.byuse, i); + #else + for (i = ((&urlspace.byname)->n - 1); i >= 0; i--) { + Channel *channelPtr; + channelPtr = (Channel *) Ns_IndexEl(&urlspace.byname, i); + #endif + WalkTrie(&channelPtr->trie, id, server, func, dsPtr, stack, channelPtr->filter); + } + Ns_MutexUnlock(&lock); + } + Index: filter.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/filter.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** filter.c 16 Feb 2005 08:39:41 -0000 1.1.1.1 --- filter.c 28 Mar 2005 17:02:07 -0000 1.2 *************** *** 307,308 **** --- 307,387 ---- return tracePtr; } + + + /* + *---------------------------------------------------------------------- + * NsGetTraces, NsGetFilters -- + * + * Returns information about registered filters/traces + * + * Results: + * DString with info as Tcl list + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + + void + NsGetFilters(Tcl_DString *dsPtr, char *server) + { + Filter *fPtr; + NsServer *servPtr; + + servPtr = NsGetServer(server); + if (servPtr == NULL) { + return; + } + fPtr = servPtr->filter.firstFilterPtr; + while (fPtr != NULL) { + Tcl_DStringStartSublist(dsPtr); + Tcl_DStringAppendElement(dsPtr, fPtr->method); + Tcl_DStringAppendElement(dsPtr, fPtr->url); + switch (fPtr->when) { + case NS_FILTER_PRE_AUTH: + Tcl_DStringAppendElement(dsPtr, "preauth"); + break; + case NS_FILTER_POST_AUTH: + Tcl_DStringAppendElement(dsPtr, "postauth"); + break; + case NS_FILTER_VOID_TRACE: + case NS_FILTER_TRACE: + Tcl_DStringAppendElement(dsPtr, "trace"); + break; + } + Ns_GetProcInfo(dsPtr, (void *) fPtr->proc, fPtr->arg); + Tcl_DStringEndSublist(dsPtr); + fPtr = fPtr->nextPtr; + } + } + + void + NsGetTraces(Tcl_DString *dsPtr, char *server) + { + Trace *tracePtr; + NsServer *servPtr; + + servPtr = NsGetServer(server); + if (servPtr == NULL) { + return; + } + tracePtr = servPtr->filter.firstTracePtr; + while (tracePtr != NULL) { + Tcl_DStringStartSublist(dsPtr); + Tcl_DStringAppendElement(dsPtr, "trace"); + Ns_GetProcInfo(dsPtr, (void *) tracePtr->proc, tracePtr->arg); + Tcl_DStringEndSublist(dsPtr); + tracePtr = tracePtr->nextPtr; + } + + tracePtr = servPtr->filter.firstCleanupPtr; + while (tracePtr != NULL) { + Tcl_DStringStartSublist(dsPtr); + Tcl_DStringAppendElement(dsPtr, "cleanup"); + Ns_GetProcInfo(dsPtr, (void *) tracePtr->proc, tracePtr->arg); + Tcl_DStringEndSublist(dsPtr); + tracePtr = tracePtr->nextPtr; + } + } + |
From: Vlad S. <ser...@us...> - 2005-03-28 17:02:28
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7358 Modified Files: ChangeLog Log Message: Added support for ns_info filters, ns_info traces, ns_info requestprocs commands using new Tcl callback interface. New commands show information about registered filters/procs same way as ns_info scheduled does. Closes RFE #1161597. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ChangeLog 27 Mar 2005 19:24:03 -0000 1.31 --- ChangeLog 28 Mar 2005 17:02:06 -0000 1.32 *************** *** 1,2 **** --- 1,12 ---- + 2005-03-28 Vlad Seryakov <ser...@us...> + + * nsd/nsd.h: + * nsd/info.c: + * nsd/op.c: + * nsd/urlspace.c: Added support for ns_info filters, + ns_info traces, ns_info requestprocs commands using new + Tcl callback interface. New commands show information about + registered filters/procs same way as ns_info scheduled does. + 2005-03-27 Vlad Seryakov <ser...@us...> |
From: Vlad S. <ser...@us...> - 2005-03-27 19:24:13
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25411/nsd Modified Files: tclrequest.c Log Message: In Ns_RegisterFilterObj command 'when' was not initialized with 0 and because this is Ored flags registered filters had incorrect mask Index: tclrequest.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclrequest.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tclrequest.c 26 Mar 2005 17:42:26 -0000 1.2 --- tclrequest.c 27 Mar 2005 19:24:04 -0000 1.3 *************** *** 241,245 **** Ns_TclCallback *cbPtr; char *method, *urlPattern, *script, *scriptarg = ""; ! int when; Ns_ObjvSpec args[] = { --- 241,245 ---- Ns_TclCallback *cbPtr; char *method, *urlPattern, *script, *scriptarg = ""; ! int when = 0; Ns_ObjvSpec args[] = { |
From: Vlad S. <ser...@us...> - 2005-03-27 19:24:12
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25411 Modified Files: ChangeLog Log Message: In Ns_RegisterFilterObj command 'when' was not initialized with 0 and because this is Ored flags registered filters had incorrect mask Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ChangeLog 26 Mar 2005 17:42:26 -0000 1.30 --- ChangeLog 27 Mar 2005 19:24:03 -0000 1.31 *************** *** 1,2 **** --- 1,8 ---- + 2005-03-27 Vlad Seryakov <ser...@us...> + + * nsd/tlrequest.c: In Ns_RegisterFilterObj command 'when' + was not initialized with 0 and because this is Ored flags + registered filters had incorrect mask. + 2005-03-26 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-03-26 17:42:44
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19580 Modified Files: ChangeLog Log Message: * include/ns.h: * nsd/nsd.h: * nsd/proc.c: * nsd/tclrequest.c: Convert to new callback and parse proc APIs. Remove support for old connId parameter. * tcl/file.tcl: * tcl/util.tcl: Remove support for old connId parameter. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ChangeLog 26 Mar 2005 16:40:39 -0000 1.29 --- ChangeLog 26 Mar 2005 17:42:26 -0000 1.30 *************** *** 3,9 **** * include/ns.h: * nsd/nsd.h: * nsd/Makefile: * nsd/tclcallbacks.c: Add routines to support calling Tcl code ! from C for callback events. * nsd/proc.c: --- 3,18 ---- * include/ns.h: * nsd/nsd.h: + * nsd/proc.c: + * nsd/tclrequest.c: Convert to new callback and parse proc APIs. + Remove support for old connId parameter. + + * tcl/file.tcl: + * tcl/util.tcl: Remove support for old connId parameter. + + * include/ns.h: + * nsd/nsd.h: * nsd/Makefile: * nsd/tclcallbacks.c: Add routines to support calling Tcl code ! from C for callback events. (RFE #1162223) * nsd/proc.c: |
From: Stephen D. <sd...@us...> - 2005-03-26 17:42:44
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19580/include Modified Files: ns.h Log Message: * include/ns.h: * nsd/nsd.h: * nsd/proc.c: * nsd/tclrequest.c: Convert to new callback and parse proc APIs. Remove support for old connId parameter. * tcl/file.tcl: * tcl/util.tcl: Remove support for old connId parameter. Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ns.h 26 Mar 2005 16:40:40 -0000 1.12 --- ns.h 26 Mar 2005 17:42:26 -0000 1.13 *************** *** 978,981 **** --- 978,982 ---- NS_EXTERN void Ns_RegisterProcInfo(void *procAddr, char *desc, Ns_ArgProc *argProc); NS_EXTERN void Ns_GetProcInfo(Tcl_DString *dsPtr, void *procAddr, void *arg); + NS_EXTERN void Ns_StringArgProc(Tcl_DString *dsPtr, void *arg); /* |
From: Stephen D. <sd...@us...> - 2005-03-26 17:42:44
|
Update of /cvsroot/naviserver/naviserver/tcl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19580/tcl Modified Files: file.tcl util.tcl Log Message: * include/ns.h: * nsd/nsd.h: * nsd/proc.c: * nsd/tclrequest.c: Convert to new callback and parse proc APIs. Remove support for old connId parameter. * tcl/file.tcl: * tcl/util.tcl: Remove support for old connId parameter. Index: file.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/tcl/file.tcl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** file.tcl 16 Feb 2005 16:45:44 -0000 1.2 --- file.tcl 26 Mar 2005 17:42:26 -0000 1.3 *************** *** 66,76 **** if { ![string equal [info commands "ns_cache"] ""] } { ! proc ns_sourceproc {conn ignored} { ns_share errorPage ! set file [ns_url2file [ns_conn url $conn]] if ![file exists $file] { ! ns_returnnotfound $conn } else { set code [catch { --- 66,76 ---- if { ![string equal [info commands "ns_cache"] ""] } { ! proc ns_sourceproc {ignored} { ns_share errorPage ! set file [ns_url2file [ns_conn url]] if ![file exists $file] { ! ns_returnnotfound } else { set code [catch { *************** *** 103,113 **** } } else { ! proc ns_sourceproc {conn ignored} { ns_share errorPage ! set file [ns_url2file [ns_conn url $conn]] if ![file exists $file] { ! ns_returnnotfound $conn } else { set code [catch { --- 103,113 ---- } } else { ! proc ns_sourceproc {ignored} { ns_share errorPage ! set file [ns_url2file [ns_conn url]] if ![file exists $file] { ! ns_returnnotfound } else { set code [catch { Index: util.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/tcl/util.tcl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** util.tcl 16 Feb 2005 16:45:45 -0000 1.2 --- util.tcl 26 Mar 2005 17:42:27 -0000 1.3 *************** *** 64,72 **** # getformdata - make sure an HTML FORM was sent with the request. ! proc getformdata {conn formVar} { upvar $formVar form ! set form [ns_conn form $conn] if {[string match "" $form]} { ! ns_returnbadrequest $conn "Missing HTML FORM data" return 0 } --- 64,72 ---- # getformdata - make sure an HTML FORM was sent with the request. ! proc getformdata {formVar} { upvar $formVar form ! set form [ns_conn form] if {[string match "" $form]} { ! ns_returnbadrequest "Missing HTML FORM data" return 0 } |
From: Stephen D. <sd...@us...> - 2005-03-26 17:42:43
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19580/nsd Modified Files: nsd.h proc.c tclrequest.c Log Message: * include/ns.h: * nsd/nsd.h: * nsd/proc.c: * nsd/tclrequest.c: Convert to new callback and parse proc APIs. Remove support for old connId parameter. * tcl/file.tcl: * tcl/util.tcl: Remove support for old connId parameter. Index: tclrequest.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclrequest.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tclrequest.c 16 Feb 2005 08:39:38 -0000 1.1.1.1 --- tclrequest.c 26 Mar 2005 17:42:26 -0000 1.2 *************** *** 1,7 **** /* ! * 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" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License [...965 lines suppressed...] result = Tcl_GetStringResult(interp); if (why == NS_FILTER_VOID_TRACE) { ! status = NS_OK; } else if (status != TCL_OK) { ! status = NS_ERROR; } else if (STREQ(result, "filter_ok")) { ! status = NS_OK; } else if (STREQ(result, "filter_break")) { ! status = NS_FILTER_BREAK; } else if (STREQ(result, "filter_return")) { ! status = NS_FILTER_RETURN; } else { ! Ns_Log(Warning, "tclfilter: %s return invalid result: %s", ! cbPtr->script, result); ! status = NS_ERROR; } Tcl_DStringFree(&cmd); ! return status; } Index: nsd.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsd.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** nsd.h 26 Mar 2005 16:40:40 -0000 1.6 --- nsd.h 26 Mar 2005 17:42:26 -0000 1.7 *************** *** 834,837 **** --- 834,840 ---- extern Ns_ThreadProc NsConnThread; extern Ns_ArgProc NsConnArgProc; + extern Ns_FilterProc NsTclFilter; + extern Ns_OpProc NsTclRequest; + extern Ns_OpProc NsAdpRequest; extern void NsGetCallbacks(Tcl_DString *dsPtr); Index: proc.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/proc.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** proc.c 26 Mar 2005 16:40:40 -0000 1.2 --- proc.c 26 Mar 2005 17:42:26 -0000 1.3 *************** *** 64,67 **** --- 64,70 ---- {(void *) NsCachePurge, "ns:cachepurge", NsCacheArgProc}, {(void *) NsConnThread, "ns:connthread", NsConnArgProc}, + {(void *) NsTclFilter, "ns:tclfilter", Ns_TclCallbackArgProc}, + {(void *) NsTclRequest, "ns:tclrequest", Ns_TclCallbackArgProc}, + {(void *) NsAdpRequest, "ns:adprequest", Ns_StringArgProc}, {NULL, NULL, NULL} }; *************** *** 189,192 **** --- 192,220 ---- *---------------------------------------------------------------------- * + * Ns_StringArgProc -- + * + * Treat arg as cstring and copy to dstring. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + void + Ns_StringArgProc(Tcl_DString *dsPtr, void *arg) + { + char *str = arg; + + Tcl_DStringAppendElement(dsPtr, str ? str : ""); + } + + + /* + *---------------------------------------------------------------------- + * * AppendAddr -- * |
From: Stephen D. <sd...@us...> - 2005-03-26 16:40:54
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17754/nsd Modified Files: Makefile nsd.h proc.c tclcmds.c tclsched.c Added Files: tclcallbacks.c Log Message: * include/ns.h: * nsd/nsd.h: * nsd/Makefile: * nsd/tclcallbacks.c: Add routines to support calling Tcl code from C for callback events. * nsd/proc.c: * nsd/tclcmds.c: * nsd/tclsched.c: Update to use new callback and parse proc APIs. Index: nsd.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsd.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** nsd.h 26 Mar 2005 14:25:25 -0000 1.5 --- nsd.h 26 Mar 2005 16:40:40 -0000 1.6 *************** *** 825,832 **** */ - extern Ns_Callback NsTclCallback; - extern Ns_Callback NsTclSignalProc; extern Ns_SchedProc NsTclSchedProc; - extern Ns_ArgProc NsTclArgProc; extern Ns_ThreadProc NsTclThread; extern Ns_ArgProc NsTclThreadArgProc; --- 825,829 ---- Index: proc.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/proc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** proc.c 16 Feb 2005 08:40:12 -0000 1.1.1.1 --- proc.c 26 Mar 2005 16:40:40 -0000 1.2 *************** *** 59,65 **** } procs[] = { {(void *) NsTclThread, "ns:tclthread", NsTclThreadArgProc}, ! {(void *) NsTclCallback, "ns:tclcallback", NsTclArgProc}, ! {(void *) NsTclSchedProc, "ns:tclschedproc", NsTclArgProc}, ! {(void *) NsTclSignalProc, "ns:tclsigproc", NsTclArgProc}, {(void *) NsTclSockProc, "ns:tclsockcallback", NsTclSockArgProc}, {(void *) NsCachePurge, "ns:cachepurge", NsCacheArgProc}, --- 59,64 ---- } procs[] = { {(void *) NsTclThread, "ns:tclthread", NsTclThreadArgProc}, ! {(void *) Ns_TclCallbackProc, "ns:tclcallback", Ns_TclCallbackArgProc}, ! {(void *) NsTclSchedProc, "ns:tclschedproc", Ns_TclCallbackArgProc}, {(void *) NsTclSockProc, "ns:tclsockcallback", NsTclSockArgProc}, {(void *) NsCachePurge, "ns:cachepurge", NsCacheArgProc}, --- NEW FILE: tclcallbacks.c --- /* * The contents of this file are subject to the Mozilla 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://mozilla.org/. * * 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. */ /* * tclcallbacks.c -- * * Support for executing Tcl code in response to a callback event. * */ static const char *RCSID = "@(#) $Header: /cvsroot/naviserver/naviserver/nsd/tclcallbacks.c,v 1.1 2005/03/26 16:40:40 sdeasey Exp $, compiled: " __DATE__ " " __TIME__; #include "ns.h" typedef void *(AtProc)(Ns_Callback *, void *); /* * Local functions defined in this file */ static int AtObjCmd(AtProc *atProc, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); /* *---------------------------------------------------------------------- * * Ns_TclNewCallback, Ns_TclNewCallbackObj -- * * Create a new script callback. * * Results: * Pointer to Ns_TclCallback. * * Side effects: * Copies are made of script and scriptarg. * *---------------------------------------------------------------------- */ Ns_TclCallback * Ns_TclNewCallback(Tcl_Interp *interp, void *cbProc, char *script, char *scriptarg) { Ns_TclCallback *cbPtr; cbPtr = ns_malloc(sizeof(Ns_TclCallback)); cbPtr->cbProc = cbProc; cbPtr->server = Ns_TclInterpServer(interp); cbPtr->script = ns_strdup(script); cbPtr->scriptarg = ns_strcopy(scriptarg); return cbPtr; } Ns_TclCallback * Ns_TclNewCallbackObj(Tcl_Interp *interp, void *cbProc, Tcl_Obj *objPtr, Tcl_Obj *argObjPtr) { return Ns_TclNewCallback(interp, cbProc, Tcl_GetString(objPtr), (argObjPtr ? Tcl_GetString(argObjPtr) : NULL)); } /* *---------------------------------------------------------------------- * * Ns_TclFreeCallback -- * * Free a callback created with Ns_TclNewCallback. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void Ns_TclFreeCallback(void *arg) { Ns_TclCallback *cbPtr = arg; ns_free(cbPtr->script); ns_free(cbPtr->scriptarg); ns_free(cbPtr); } /* *---------------------------------------------------------------------- * * Ns_TclEvalCallback -- * * Evaluate a Tcl callback in the given interp. * * Results: * Tcl return code. Result of successful script execution will * be appended to dstring if given. * * Side effects: * An interp may be allocated if none given and none already * cached for current thread. * *---------------------------------------------------------------------- */ int Ns_TclEvalCallback(Tcl_Interp *interp, Ns_TclCallback *cbPtr, Ns_DString *result, ...) { va_list ap; Ns_DString ds; char *arg; int deallocInterp = 0; int status = TCL_ERROR; if (interp == NULL) { interp = Ns_TclAllocateInterp(cbPtr->server); deallocInterp = 1; } if (interp != NULL) { Ns_DStringInit(&ds); Ns_DStringAppend(&ds, cbPtr->script); va_start(ap, result); while ((arg = va_arg(ap, char *)) != NULL) { Ns_DStringAppendElement(&ds, arg); } va_end(ap); if (cbPtr->scriptarg) { Ns_DStringAppendElement(&ds, cbPtr->scriptarg); } status = Tcl_EvalEx(interp, ds.string, ds.length, 0); if (status != TCL_OK) { Ns_DStringTrunc(&ds, 0); Ns_DStringAppend(&ds, "\n while executing callback\n"); Ns_GetProcInfo(&ds, cbPtr->cbProc, cbPtr); Tcl_AddObjErrorInfo(interp, ds.string, ds.length); Ns_TclLogError(interp); } else if (result != NULL) { Ns_DStringAppend(result, Tcl_GetStringResult(interp)); } Ns_DStringFree(&ds); if (deallocInterp) { Ns_TclDeAllocateInterp(interp); } } return status; } /* *---------------------------------------------------------------------- * * Ns_TclCallbackProc -- * * Callback routine which evaluates the registered Tcl script. * * Results: * None. * * Side effects: * Depends on Tcl script. * *---------------------------------------------------------------------- */ void Ns_TclCallbackProc(void *arg) { Ns_TclCallback *cbPtr = arg; (void) Ns_TclEvalCallback(NULL, cbPtr, NULL, NULL); } /* *---------------------------------------------------------------------- * * Ns_TclCallbackArgProc -- * * Proc info routine to copy Tcl callback script. * * Results: * None. * * Side effects: * Will copy script to given dstring. * *---------------------------------------------------------------------- */ void Ns_TclCallbackArgProc(Tcl_DString *dsPtr, void *arg) { Ns_TclCallback *cbPtr = arg; Tcl_DStringAppendElement(dsPtr, cbPtr->script); if (cbPtr->scriptarg != NULL) { Tcl_DStringAppendElement(dsPtr, cbPtr->scriptarg); } } /* *---------------------------------------------------------------------- * * AtObjCmd -- * * Implements ns_atsignal, ns_atshutdown, ns_atstartup, ns_atexit. * * Results: * Tcl result. * * Side effects: * See docs. * *---------------------------------------------------------------------- */ static int AtObjCmd(AtProc *atProc, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Ns_TclCallback *cbPtr; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "script ?arg?"); return TCL_ERROR; } cbPtr = Ns_TclNewCallbackObj(interp, Ns_TclCallbackProc, objv[1], (objc == 3) ? objv[2] : NULL); (*atProc)(Ns_TclCallbackProc, cbPtr); return TCL_OK; } int NsTclAtStartupObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { return AtObjCmd(Ns_RegisterAtStartup, interp, objc, objv); } int NsTclAtSignalObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { return AtObjCmd(Ns_RegisterAtSignal, interp, objc, objv); } int NsTclAtShutdownObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { return AtObjCmd(Ns_RegisterShutdown, interp, objc, objv); } int NsTclAtExitObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { return AtObjCmd(Ns_RegisterAtExit, interp, objc, objv); } Index: tclcmds.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclcmds.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tclcmds.c 26 Mar 2005 15:53:06 -0000 1.6 --- tclcmds.c 26 Mar 2005 16:40:40 -0000 1.7 *************** *** 63,66 **** --- 63,72 ---- NsTclAdpMimeTypeObjCmd, NsTclAdpCompressObjCmd, + NsTclAfterObjCmd, + NsTclAtExitObjCmd, + NsTclAtStartupObjCmd, + NsTclAtShutdownObjCmd, + NsTclAtSignalObjCmd, + NsTclCancelObjCmd, NsTclChanObjCmd, NsTclChmodObjCmd, *************** *** 114,117 **** --- 120,124 ---- NsTclParseHttpTimeObjCmd, NsTclParseQueryObjCmd, + NsTclPauseObjCmd, NsTclPurgeFilesObjCmd, NsTclRandObjCmd, *************** *** 123,126 **** --- 130,134 ---- NsTclRequestAuthorizeObjCmd, NsTclRespondObjCmd, + NsTclResumeObjCmd, NsTclReturnBadRequestObjCmd, NsTclReturnErrorObjCmd, *************** *** 135,138 **** --- 143,149 ---- NsTclRollFileObjCmd, NsTclRWLockObjCmd, + NsTclSchedObjCmd, + NsTclSchedDailyObjCmd, + NsTclSchedWeeklyObjCmd, NsTclSelectObjCmd, NsTclSemaObjCmd, *************** *** 160,163 **** --- 171,175 ---- NsTclUnRegisterObjCmd, NsTclUnlinkObjCmd, + NsTclUnscheduleObjCmd, NsTclUrl2FileObjCmd, NsTclUrlDecodeObjCmd, *************** *** 175,184 **** NsTclAdpRegisterProcCmd, NsTclAdpStatsCmd, - NsTclAfterCmd, NsTclAtCloseCmd, - NsTclAtExitCmd, - NsTclAtStartupCmd, - NsTclAtShutdownCmd, - NsTclAtSignalCmd, NsTclCacheFlushCmd, NsTclCacheKeysCmd, --- 187,191 ---- *************** *** 186,190 **** NsTclCacheSizeCmd, NsTclCacheStatsCmd, - NsTclCancelCmd, NsTclCharsetsCmd, NsTclConfigCmd, --- 193,196 ---- *************** *** 198,214 **** NsTclMkTempCmd, NsTclParseHeaderCmd, - NsTclPauseCmd, NsTclQuoteHtmlCmd, NsTclRegisterTagCmd, - NsTclResumeCmd, NsTclReturnAdminNoticeCmd, NsTclReturnNoticeCmd, - NsTclSchedCmd, - NsTclSchedDailyCmd, - NsTclSchedWeeklyCmd, NsTclShareCmd, NsTclStripHtmlCmd, NsTclThreadCmd, - NsTclUnscheduleCmd, TclX_KeyldelObjCmd, TclX_KeylgetObjCmd, --- 204,214 ---- *************** *** 274,277 **** --- 274,286 ---- /* + * tclcallbacks.c + */ + + {"ns_atsignal", NULL, NsTclAtSignalObjCmd}, + {"ns_atstartup", NULL, NsTclAtStartupObjCmd}, + {"ns_atshutdown", NULL, NsTclAtShutdownObjCmd}, + {"ns_atexit", NULL, NsTclAtExitObjCmd}, + + /* * tclconf.c */ *************** *** 327,342 **** */ ! {"ns_schedule_proc", NsTclSchedCmd, NULL}, ! {"ns_schedule_daily", NsTclSchedDailyCmd, NULL}, ! {"ns_schedule_weekly", NsTclSchedWeeklyCmd, NULL}, ! {"ns_atsignal", NsTclAtSignalCmd, NULL}, ! {"ns_atstartup", NsTclAtStartupCmd, NULL}, ! {"ns_atshutdown", NsTclAtShutdownCmd, NULL}, ! {"ns_atexit", NsTclAtExitCmd, NULL}, ! {"ns_after", NsTclAfterCmd, NULL}, ! {"ns_cancel", NsTclCancelCmd, NULL}, ! {"ns_pause", NsTclPauseCmd, NULL}, ! {"ns_resume", NsTclResumeCmd, NULL}, ! {"ns_unschedule_proc", NsTclUnscheduleCmd, NULL}, /* --- 336,347 ---- */ ! {"ns_schedule_proc", NULL, NsTclSchedObjCmd}, ! {"ns_schedule_daily", NULL, NsTclSchedDailyObjCmd}, ! {"ns_schedule_weekly", NULL, NsTclSchedWeeklyObjCmd}, ! {"ns_after", NULL, NsTclAfterObjCmd}, ! {"ns_cancel", NULL, NsTclCancelObjCmd}, ! {"ns_pause", NULL, NsTclPauseObjCmd}, ! {"ns_resume", NULL, NsTclResumeObjCmd}, ! {"ns_unschedule_proc", NULL, NsTclUnscheduleObjCmd}, /* Index: Makefile =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 26 Mar 2005 15:53:06 -0000 1.3 --- Makefile 26 Mar 2005 16:40:40 -0000 1.4 *************** *** 46,50 **** quotehtml.o random.o request.o return.o rollfile.o sched.o \ server.o set.o sock.o sockcallback.o str.o tclatclose.o \ ! tclcmds.o tclconf.o tclenv.o tclfile.o tclhttp.o tclimg.o \ tclinit.o tcljob.o tclmisc.o tclobj.o tclobjv.o tclrequest.o tclresp.o \ tclsched.o tclset.o tclshare.o tclsock.o tclthread.o tclvar.o \ --- 46,50 ---- quotehtml.o random.o request.o return.o rollfile.o sched.o \ server.o set.o sock.o sockcallback.o str.o tclatclose.o \ ! tclcallbacks.o tclcmds.o tclconf.o tclenv.o tclfile.o tclhttp.o tclimg.o \ tclinit.o tcljob.o tclmisc.o tclobj.o tclobjv.o tclrequest.o tclresp.o \ tclsched.o tclset.o tclshare.o tclsock.o tclthread.o tclvar.o \ Index: tclsched.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclsched.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tclsched.c 22 Feb 2005 20:33:36 -0000 1.2 --- tclsched.c 26 Mar 2005 16:40:40 -0000 1.3 *************** *** 32,36 **** * tclsched.c -- * ! * Implement scheduled procs in Tcl. */ --- 32,36 ---- * tclsched.c -- * ! * Implement scheduled procs in Tcl. */ [...1020 lines suppressed...] ! * Side effects: ! * Will copy script to given dstring. ! * ! *---------------------------------------------------------------------- ! */ ! ! void ! NsTclArgProc(Tcl_DString *dsPtr, void *arg) ! { ! Callback *cbPtr = arg; ! ! Tcl_DStringAppendElement(dsPtr, cbPtr->script); } --- 430,435 ---- static void FreeSched(void *arg, int id) { ! Ns_TclFreeCallback(arg); } |
From: Stephen D. <sd...@us...> - 2005-03-26 16:40:53
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17754 Modified Files: ChangeLog Log Message: * include/ns.h: * nsd/nsd.h: * nsd/Makefile: * nsd/tclcallbacks.c: Add routines to support calling Tcl code from C for callback events. * nsd/proc.c: * nsd/tclcmds.c: * nsd/tclsched.c: Update to use new callback and parse proc APIs. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ChangeLog 26 Mar 2005 15:53:06 -0000 1.28 --- ChangeLog 26 Mar 2005 16:40:39 -0000 1.29 *************** *** 2,5 **** --- 2,15 ---- * include/ns.h: + * nsd/nsd.h: + * nsd/Makefile: + * nsd/tclcallbacks.c: Add routines to support calling Tcl code + from C for callback events. + + * nsd/proc.c: + * nsd/tclcmds.c: + * nsd/tclsched.c: Update to use new callback and parse proc APIs. + + * include/ns.h: * nsd/Makefile: * nsd/tclcmds.c: |
From: Stephen D. <sd...@us...> - 2005-03-26 16:40:53
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17754/include Modified Files: ns.h Log Message: * include/ns.h: * nsd/nsd.h: * nsd/Makefile: * nsd/tclcallbacks.c: Add routines to support calling Tcl code from C for callback events. * nsd/proc.c: * nsd/tclcmds.c: * nsd/tclsched.c: Update to use new callback and parse proc APIs. Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ns.h 26 Mar 2005 15:53:06 -0000 1.11 --- ns.h 26 Mar 2005 16:40:40 -0000 1.12 *************** *** 388,391 **** --- 388,403 ---- /* + * The following structure defines the Tcl code to run + * for a callback function. + */ + + typedef struct Ns_TclCallback { + void *cbProc; + char *server; + char *script; + char *scriptarg; + } Ns_TclCallback; + + /* * The following structure defines an I/O * scatter/gather buffer for WIN32. *************** *** 964,968 **** */ - NS_EXTERN void Ns_RegisterProcDesc(void *procAddr, char *desc); NS_EXTERN void Ns_RegisterProcInfo(void *procAddr, char *desc, Ns_ArgProc *argProc); NS_EXTERN void Ns_GetProcInfo(Tcl_DString *dsPtr, void *procAddr, void *arg); --- 976,979 ---- *************** *** 1163,1166 **** --- 1174,1193 ---- /* + * tclcallbacks.c: + */ + + NS_EXTERN Ns_TclCallback *Ns_TclNewCallback(Tcl_Interp *interp, void *cbProc, + char *script, char *scriptarg); + NS_EXTERN Ns_TclCallback *Ns_TclNewCallbackObj(Tcl_Interp *interp, + void *cbProc, + Tcl_Obj *scriptObjPtr, + Tcl_Obj *argObjPtr); + NS_EXTERN int Ns_TclEvalCallback(Tcl_Interp *interp, Ns_TclCallback *cbPtr, + Ns_DString *result, ...); + NS_EXTERN Ns_Callback Ns_TclCallbackProc; + NS_EXTERN Ns_Callback Ns_TclFreeCallback; + NS_EXTERN Ns_ArgProc Ns_TclCallbackArgProc; + + /* * tclenv.c: */ |
From: Stephen D. <sd...@us...> - 2005-03-26 15:53:16
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21928/nsd Modified Files: Makefile tclcmds.c Added Files: cookies.c Log Message: * include/ns.h: * nsd/Makefile: * nsd/tclcmds.c: * nsd/cookies.c: Add cookie API for C and Tcl. (RFE #1145957) --- NEW FILE: cookies.c --- /* * The contents of this file are subject to the Mozilla 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://mozilla.org/. * * 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. */ /* * cookies.c -- * * Routines to manipulate HTTP cookie headers. * */ static const char *RCSID = "@(#) $Header: /cvsroot/naviserver/naviserver/nsd/cookies.c,v 1.1 2005/03/26 15:53:06 sdeasey Exp $, compiled: " __DATE__ " " __TIME__; #include "nsd.h" /* * Local functions defined in this file. */ static Ns_Conn *GetConn(Tcl_Interp *interp); /* *---------------------------------------------------------------------- * * Ns_ConnSetCookie, Ns_ConnSetCookieEx, Ns_ConnSetSecureCookie -- * * Set a cookie for the given connection. * * Results: * None. * * Side effects: * Existing cookie with same name, path, domain will be dropped * by client. * *---------------------------------------------------------------------- */ void Ns_ConnSetCookieEx(Ns_Conn *conn, char *name, char *value, int maxage, char *domain, char *path, int secure) { Ns_DString cookie; Ns_Set *headers; Ns_DStringInit(&cookie); Ns_DStringVarAppend(&cookie, name, "=\"", NULL); if (value != NULL) { Ns_UrlQueryEncode(&cookie, value, NULL); } Ns_DStringAppend(&cookie, "\""); if (maxage == INT_MAX) { Ns_DStringAppend(&cookie, "; Expires=Fri, 01-Jan-2035 01:00:00 GMT"); } else if (maxage > 0) { Ns_DStringPrintf(&cookie, "; Max-Age=%d", maxage); } else if (maxage < 0) { Ns_DStringAppend(&cookie, "; Expires=Fri, 01-Jan-1980 01:00:00 GMT"); } if (domain != NULL) { Ns_DStringVarAppend(&cookie, "; Domain=", domain, NULL); } if (path != NULL) { Ns_DStringVarAppend(&cookie, "; Path=", domain, NULL); } if (secure == NS_TRUE) { Ns_DStringAppend(&cookie, "; Secure"); } headers = Ns_ConnOutputHeaders(conn); Ns_SetPut(headers, "Set-Cookie", cookie.string); Ns_DStringFree(&cookie); } void Ns_ConnSetCookie(Ns_Conn *conn, char *name, char *value, int maxage) { Ns_ConnSetCookieEx(conn, name, value, maxage, NULL, NULL, NS_FALSE); } void Ns_ConnSetSecureCookie(Ns_Conn *conn, char *name, char *value, int maxage) { Ns_ConnSetCookieEx(conn, name, value, maxage, NULL, NULL, NS_TRUE); } /* *---------------------------------------------------------------------- * * Ns_ConnDeleteCookie, Ns_ConnDeleteSecureCookie -- * * Expire immediately the cookie with matching name, domain and path. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void Ns_ConnDeleteCookie(Ns_Conn *conn, char *name, char *domain, char *path) { Ns_ConnSetCookieEx(conn, name, NULL, -1, domain, path, NS_FALSE); } void Ns_ConnDeleteSecureCookie(Ns_Conn *conn, char *name, char *domain, char *path) { Ns_ConnSetCookieEx(conn, name, NULL, -1, domain, path, NS_TRUE); } /* *---------------------------------------------------------------------- * * Ns_ConnGetCookie -- * * Get first matching cookie for the given connection. * * Results: * dest->string or NULL on error. * * Side effects: * Cookie value is UrlQueryDecoded before placement in dest. * *---------------------------------------------------------------------- */ char * Ns_ConnGetCookie(Ns_DString *dest, Ns_Conn *conn, char *name) { Ns_Set *hdrs = Ns_ConnHeaders(conn); char *p, *q, *value = NULL; char save; int nameLen, i; nameLen = strlen(name); for (i = 0; i < hdrs->size; ++i) { if (strcasecmp(hdrs->fields[i].name, "Cookie") == 0 && (p = strstr(hdrs->fields[i].value, name)) != NULL) { if (*(p += nameLen) == '=') { ++p; /* advance past equals sign */ if (*p == '"') { ++p; /* advance past optional quote mark */ } q = p; while (*q != '"' && *q != ';' && *q != '\0') { ++q; } save = *q; *q = '\0'; value = Ns_UrlQueryDecode(dest, p, NULL); *q = save; break; } } } return value; } /* *---------------------------------------------------------------------- * * NsTclSetCookieObjCmd -- * * Implements the ns_setcookie command. * * Results: * Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ int NsTclSetCookieObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Ns_Conn *conn = GetConn(interp); char *name, *data, *domain = NULL, *path = NULL; int maxage = 0, secure = NS_FALSE; Ns_ObjvSpec opts[] = { {"-secure", Ns_ObjvBool, &secure, NULL}, {"-domain", Ns_ObjvString, &domain, NULL}, {"-path", Ns_ObjvString, &path, NULL}, {"-maxage", Ns_ObjvInt, &maxage, NULL}, {"--", Ns_ObjvBreak, NULL, NULL}, {NULL, NULL, NULL, NULL} }; Ns_ObjvSpec args[] = { {"name", Ns_ObjvString, &name, NULL}, {"data", Ns_ObjvString, &data, NULL}, {NULL, NULL, NULL, NULL} }; if (conn == NULL || Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) { return TCL_ERROR; } Ns_ConnSetCookieEx(conn, name, data, maxage, domain, path, secure); return TCL_OK; } /* *---------------------------------------------------------------------- * * NsTclGetCookieObjCmd -- * * Implements the ns_getcookie command. The given default will be * returned if no matching cookie exists. * * Results: * Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ int NsTclGetCookieObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Ns_Conn *conn; Ns_DString ds; int status = TCL_OK; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "name ?default?"); return TCL_ERROR; } if ((conn = GetConn(interp)) == NULL) { return TCL_ERROR; } Ns_DStringInit(&ds); if (Ns_ConnGetCookie(&ds, conn, Tcl_GetString(objv[1]))) { Tcl_DStringResult(interp, &ds); } else if (objc == 3) { Tcl_SetObjResult(interp, objv[2]); } else { Tcl_SetResult(interp, "no matching cookie", TCL_STATIC); status = TCL_ERROR; } Ns_DStringFree(&ds); return status; } /* *---------------------------------------------------------------------- * * NsTclDeleteCookieObjCmd -- * * Implements the ns_deletecookie command. * * Results: * Tcl result. * * Side effects: * See Ns_ConnDeleteCookie(). * *---------------------------------------------------------------------- */ int NsTclDeleteCookieObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Ns_Conn *conn = GetConn(interp); char *name, *domain = NULL, *path = NULL; int secure = NS_FALSE; Ns_ObjvSpec opts[] = { {"-secure", Ns_ObjvBool, &secure, NULL}, {"-domain", Ns_ObjvString, &domain, NULL}, {"-path", Ns_ObjvString, &path, NULL}, {"--", Ns_ObjvBreak, NULL, NULL}, {NULL, NULL, NULL, NULL} }; Ns_ObjvSpec args[] = { {"name", Ns_ObjvString, &name, NULL}, {NULL, NULL, NULL, NULL} }; if (conn == NULL || Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) { return TCL_ERROR; } Ns_ConnSetCookieEx(conn, name, NULL, -1, domain, path, secure); return TCL_OK; } /* *---------------------------------------------------------------------- * * GetConn -- * * Get the conn and make sure the headers have not already * been sent. * * Results: * Ns_Conn pointer or NULL on error. * * Side effects: * None. * *---------------------------------------------------------------------- */ static Ns_Conn * GetConn(Tcl_Interp *interp) { Ns_Conn *conn = Ns_TclGetConn(interp); if (conn == NULL) { Tcl_SetResult(interp, "No connection available.", TCL_STATIC); } else if (conn->flags & NS_CONN_SENTHDRS) { Tcl_SetResult(interp, "Cannot set cookie, " "reponse headers already sent to user-agent.", TCL_STATIC); } return conn; } Index: tclcmds.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclcmds.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tclcmds.c 26 Mar 2005 14:25:25 -0000 1.5 --- tclcmds.c 26 Mar 2005 15:53:06 -0000 1.6 *************** *** 72,79 **** --- 72,81 ---- NsTclCryptObjCmd, NsTclCritSecObjCmd, + NsTclDeleteCookieObjCmd, NsTclDummyObjCmd, NsTclICtlObjCmd, NsTclFTruncateObjCmd, NsTclGetAddrObjCmd, + NsTclGetCookieObjCmd, NsTclGetHostObjCmd, NsTclGetUrlObjCmd, *************** *** 136,139 **** --- 138,142 ---- NsTclSemaObjCmd, NsTclServerObjCmd, + NsTclSetCookieObjCmd, NsTclSetObjCmd, NsTclShutdownObjCmd, *************** *** 490,493 **** --- 493,504 ---- /* + * cookies.c + */ + + {"ns_deletecookie", NULL, NsTclDeleteCookieObjCmd}, + {"ns_getcookie", NULL, NsTclGetCookieObjCmd}, + {"ns_setcookie", NULL, NsTclSetCookieObjCmd}, + + /* * adpparse.c */ Index: Makefile =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 26 Feb 2005 17:16:32 -0000 1.2 --- Makefile 26 Mar 2005 15:53:06 -0000 1.3 *************** *** 40,44 **** LOBJS = adpcmds.o adpeval.o adpparse.o adprequest.o auth.o binder.o \ cache.o callbacks.o cls.o compress.o config.o conn.o connio.o \ ! crypt.o dns.o driver.o dsprintf.o dstring.o encoding.o exec.o \ fastpath.o fd.o filter.o form.o httptime.o index.o info.o \ init.o lisp.o listen.o log.o mimetypes.o modload.o nsconf.o \ --- 40,44 ---- LOBJS = adpcmds.o adpeval.o adpparse.o adprequest.o auth.o binder.o \ cache.o callbacks.o cls.o compress.o config.o conn.o connio.o \ ! cookies.o crypt.o dns.o driver.o dsprintf.o dstring.o encoding.o exec.o \ fastpath.o fd.o filter.o form.o httptime.o index.o info.o \ init.o lisp.o listen.o log.o mimetypes.o modload.o nsconf.o \ |
From: Stephen D. <sd...@us...> - 2005-03-26 15:53:15
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21928 Modified Files: ChangeLog Log Message: * include/ns.h: * nsd/Makefile: * nsd/tclcmds.c: * nsd/cookies.c: Add cookie API for C and Tcl. (RFE #1145957) Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ChangeLog 26 Mar 2005 14:25:13 -0000 1.27 --- ChangeLog 26 Mar 2005 15:53:06 -0000 1.28 *************** *** 2,5 **** --- 2,10 ---- * include/ns.h: + * nsd/Makefile: + * nsd/tclcmds.c: + * nsd/cookies.c: Add cookie API for C and Tcl. (RFE #1145957) + + * include/ns.h: * nsd/nsd.h: * nsd/tclobjv.c: |
From: Stephen D. <sd...@us...> - 2005-03-26 15:53:14
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21928/include Modified Files: ns.h Log Message: * include/ns.h: * nsd/Makefile: * nsd/tclcmds.c: * nsd/cookies.c: Add cookie API for C and Tcl. (RFE #1145957) Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ns.h 26 Mar 2005 14:25:16 -0000 1.10 --- ns.h 26 Mar 2005 15:53:06 -0000 1.11 *************** *** 645,648 **** --- 645,660 ---- /* + * cookies.c: + */ + + NS_EXTERN void Ns_ConnSetCookie(Ns_Conn *conn, char *name, char *value, int maxage); + NS_EXTERN void Ns_ConnSetSecureCookie(Ns_Conn *conn, char *name, char *value, int maxage); + NS_EXTERN void Ns_ConnSetCookieEx(Ns_Conn *conn, char *name, char *value, int maxage, + char *domain, char *path, int secure); + NS_EXTERN void Ns_ConnDeleteCookie(Ns_Conn *conn, char *name, char *domain, char *path); + NS_EXTERN void Ns_ConnDeleteSecureCookie(Ns_Conn *conn, char *name, char *domain, char *path); + NS_EXTERN char *Ns_ConnGetCookie(Ns_DString *dest, Ns_Conn *conn, char *name); + + /* * crypt.c: */ |
From: Stephen D. <sd...@us...> - 2005-03-26 14:25:56
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3873 Modified Files: ChangeLog Log Message: * include/ns.h: * nsd/nsd.h: * nsd/tclobjv.c: * nsd/tclcmds.c: * tests/ns_parseargs.test: Change the signature of Ns_ObjvProc()s to return either TCL_OK, TCL_ERROR or TCL_BREAK. Fixes a bug where options were being double-counted as args. Also simplified the Ns_ObjvProc interface by passing the Ns_ObjvSpec directly. Added a new Tcl command: ns_parseargs specification args. It parses options, args and handles defaults. * nsd/tclobj.c: Added some wrapper procs for handling Tcl obj types. * nsd/tclinit.c: Added Ns_TclPrintfResult() as a convenience for writing ints into a formatted string result. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ChangeLog 24 Mar 2005 01:17:54 -0000 1.26 --- ChangeLog 26 Mar 2005 14:25:13 -0000 1.27 *************** *** 1,2 **** --- 1,22 ---- + 2005-03-26 Stephen Deasey <sd...@us...> + + * include/ns.h: + * nsd/nsd.h: + * nsd/tclobjv.c: + * nsd/tclcmds.c: + * tests/ns_parseargs.test: Change the signature of Ns_ObjvProc()s + to return either TCL_OK, TCL_ERROR or TCL_BREAK. Fixes a bug + where options were being double-counted as args. Also simplified + the Ns_ObjvProc interface by passing the Ns_ObjvSpec directly. + + Added a new Tcl command: ns_parseargs specification args. It + parses options, args and handles defaults. + + * nsd/tclobj.c: Added some wrapper procs for handling Tcl obj + types. + + * nsd/tclinit.c: Added Ns_TclPrintfResult() as a convenience for + writing ints into a formatted string result. + 2005-03-23 Vlad Seryakov <vl...@cr...> |
From: Stephen D. <sd...@us...> - 2005-03-26 14:25:35
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3873/nsd Modified Files: nsd.h tclcmds.c tclinit.c tclobj.c tclobjv.c Log Message: * include/ns.h: * nsd/nsd.h: * nsd/tclobjv.c: * nsd/tclcmds.c: * tests/ns_parseargs.test: Change the signature of Ns_ObjvProc()s to return either TCL_OK, TCL_ERROR or TCL_BREAK. Fixes a bug where options were being double-counted as args. Also simplified the Ns_ObjvProc interface by passing the Ns_ObjvSpec directly. Added a new Tcl command: ns_parseargs specification args. It parses options, args and handles defaults. * nsd/tclobj.c: Added some wrapper procs for handling Tcl obj types. * nsd/tclinit.c: Added Ns_TclPrintfResult() as a convenience for writing ints into a formatted string result. Index: tclobj.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclobj.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tclobj.c 16 Feb 2005 08:40:34 -0000 1.1.1.1 --- tclobj.c 26 Mar 2005 14:25:25 -0000 1.2 *************** *** 61,64 **** --- 61,65 ---- static Tcl_ObjType *intTypePtr; + /* *************** *** 100,103 **** --- 101,214 ---- *---------------------------------------------------------------------- * + * Ns_TclResetObjType -- + * + * Reset the given Tcl_Obj type, freeing any type specific + * internal representation. + * + * Results: + * None. + * + * Side effects: + * Depends on object type. + * + *---------------------------------------------------------------------- + */ + + void + Ns_TclResetObjType(Tcl_Obj *objPtr, Tcl_ObjType *newTypePtr) + { + Tcl_ObjType *typePtr = objPtr->typePtr; + + if (typePtr != NULL && typePtr->freeIntRepProc != NULL) { + (typePtr->freeIntRepProc)(objPtr); + } + objPtr->typePtr = newTypePtr; + } + + + /* + *---------------------------------------------------------------------- + * + * Ns_TclSetTwoPtrValue -- + * + * Reset the given objects type and values, freeing any existing + * internal rep. + * + * Results: + * None. + * + * Side effects: + * Depends on object type. + * + *---------------------------------------------------------------------- + */ + + void + Ns_TclSetTwoPtrValue(Tcl_Obj *objPtr, Tcl_ObjType *newTypePtr, + void *ptr1, void *ptr2) + { + Ns_TclResetObjType(objPtr, newTypePtr); + objPtr->internalRep.twoPtrValue.ptr1 = ptr1; + objPtr->internalRep.twoPtrValue.ptr2 = ptr2; + } + + + /* + *---------------------------------------------------------------------- + * + * Ns_TclSetOtherValuePtr -- + * + * Reset the given objects type and value, freeing any existing + * internal rep. + * + * Results: + * None. + * + * Side effects: + * Depends on object type. + * + *---------------------------------------------------------------------- + */ + + void + Ns_TclSetOtherValuePtr(Tcl_Obj *objPtr, Tcl_ObjType *newTypePtr, void *value) + { + Ns_TclResetObjType(objPtr, newTypePtr); + objPtr->internalRep.otherValuePtr = value; + } + + + /* + *---------------------------------------------------------------------- + * + * Ns_TclSetStringRep -- + * + * Copy length bytes and set objects string rep. The objects + * existing string rep *must* have already been freed. + * + * Results: + * None. + * + * Side effects: + * Memory is allocated. + * + *---------------------------------------------------------------------- + */ + + void + Ns_TclSetStringRep(Tcl_Obj *objPtr, char *bytes, int length) + { + if (length < 1) { + length = strlen(bytes); + } + objPtr->length = length; + objPtr->bytes = ckalloc((size_t) length + 1); + memcpy(objPtr->bytes, bytes, (size_t) length + 1); + } + + + /* + *---------------------------------------------------------------------- + * * Ns_TclSetTimeObj -- * *************** *** 179,183 **** { Ns_Time *timePtr = (Ns_Time *) &objPtr->internalRep; ! size_t len; char buf[100]; --- 290,294 ---- { Ns_Time *timePtr = (Ns_Time *) &objPtr->internalRep; ! int len; char buf[100]; *************** *** 188,194 **** len = sprintf(buf, "%ld:%ld", timePtr->sec, timePtr->usec); } ! objPtr->length = len; ! objPtr->bytes = ckalloc(len + 1); ! memcpy(objPtr->bytes, buf, len + 1); } --- 299,303 ---- len = sprintf(buf, "%ld:%ld", timePtr->sec, timePtr->usec); } ! Ns_TclSetStringRep(objPtr, buf, len); } *************** *** 264,273 **** SetTimeInternalRep(Tcl_Obj *objPtr, Ns_Time *timePtr) { ! Tcl_ObjType *typePtr = objPtr->typePtr; ! ! if (typePtr != NULL && typePtr->freeIntRepProc != NULL) { ! (*typePtr->freeIntRepProc)(objPtr); ! } ! objPtr->typePtr = &timeType; *((Ns_Time *) &objPtr->internalRep) = *timePtr; Tcl_InvalidateStringRep(objPtr); --- 373,377 ---- SetTimeInternalRep(Tcl_Obj *objPtr, Ns_Time *timePtr) { ! Ns_TclResetObjType(objPtr, &timeType); *((Ns_Time *) &objPtr->internalRep) = *timePtr; Tcl_InvalidateStringRep(objPtr); Index: tclcmds.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclcmds.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tclcmds.c 6 Mar 2005 22:48:27 -0000 1.4 --- tclcmds.c 26 Mar 2005 14:25:25 -0000 1.5 *************** *** 109,112 **** --- 109,113 ---- NsTclNsvSetObjCmd, NsTclNsvUnsetObjCmd, + NsTclParseArgsObjCmd, NsTclParseHttpTimeObjCmd, NsTclParseQueryObjCmd, *************** *** 408,411 **** --- 409,418 ---- /* + * tclobjv.c + */ + + {"ns_parseargs", NULL, NsTclParseArgsObjCmd}, + + /* * Add more basic Tcl commands here. */ Index: tclinit.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclinit.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tclinit.c 16 Feb 2005 08:40:05 -0000 1.1.1.1 --- tclinit.c 26 Mar 2005 14:25:25 -0000 1.2 *************** *** 157,160 **** --- 157,190 ---- *---------------------------------------------------------------------- * + * Ns_TclPrintfResult -- + * + * Leave a formatted message in the given Tcl interps result. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + void + Ns_TclPrintfResult(Tcl_Interp *interp, char *fmt, ...) + { + va_list ap; + Tcl_DString ds; + + Tcl_DStringInit(&ds); + va_start(ap, fmt); + Ns_DStringVPrintf(&ds, fmt, ap); + va_end(ap); + Tcl_DStringResult(interp, &ds); + } + + + /* + *---------------------------------------------------------------------- + * * Ns_TclInitInterps -- * *************** *** 1148,1151 **** --- 1178,1182 ---- NsTclInitAddrType(); NsTclInitTimeType(); + NsTclInitSpecType(); initialized = 1; } Index: nsd.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsd.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nsd.h 18 Mar 2005 08:21:06 -0000 1.4 --- nsd.h 26 Mar 2005 14:25:25 -0000 1.5 *************** *** 923,926 **** --- 923,927 ---- extern void NsTclInitAddrType(void); extern void NsTclInitTimeType(void); + extern void NsTclInitSpecType(void); /* Index: tclobjv.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclobjv.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tclobjv.c 4 Mar 2005 09:24:14 -0000 1.3 --- tclobjv.c 26 Mar 2005 14:25:25 -0000 1.4 *************** *** 35,46 **** /* * Static functions defined in this file. */ ! static void WrongNumArgs(Ns_ObjvSpec *optSpec, Ns_ObjvSpec *argSpec, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); [...1209 lines suppressed...] ! } else if (specPtr->proc == &Ns_ObjvBool && specPtr->arg != NULL) { ! Ns_DStringPrintf(&ds, "?%s? ", specPtr->key); ! } else { ! p = specPtr->key; ! if (*specPtr->key == '-') { ! ++p; ! } ! Ns_DStringPrintf(&ds, "?%s %s? ", specPtr->key, p); } } } ! if (argSpec != NULL) { ! for (specPtr = argSpec; specPtr->key != NULL; ++specPtr) { ! Ns_DStringPrintf(&ds, "%s%s ", specPtr->key, ! (*specPtr->key == '?') ? "?" : ""); ! } } + Ns_DStringTrunc(&ds, Ns_DStringLength(&ds) - 1); Tcl_WrongNumArgs(interp, objc, objv, ds.string); Ns_DStringFree(&ds); |
From: Stephen D. <sd...@us...> - 2005-03-26 14:25:35
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3873/tests Added Files: ns_parseargs.test Log Message: * include/ns.h: * nsd/nsd.h: * nsd/tclobjv.c: * nsd/tclcmds.c: * tests/ns_parseargs.test: Change the signature of Ns_ObjvProc()s to return either TCL_OK, TCL_ERROR or TCL_BREAK. Fixes a bug where options were being double-counted as args. Also simplified the Ns_ObjvProc interface by passing the Ns_ObjvSpec directly. Added a new Tcl command: ns_parseargs specification args. It parses options, args and handles defaults. * nsd/tclobj.c: Added some wrapper procs for handling Tcl obj types. * nsd/tclinit.c: Added Ns_TclPrintfResult() as a convenience for writing ints into a formatted string result. --- NEW FILE: ns_parseargs.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_parseargs.test,v 1.1 2005/03/26 14:25:26 sdeasey Exp $ # load ../nsd/libnsd.so package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test ns_parseargs-1.1 {basic syntax} -body { ns_parseargs } -returnCodes error -result {wrong # args: should be "ns_parseargs specification args"} test ns_parseargs-1.2 {basic syntax} -body { ns_parseargs {} {} } -result {} test ns_parseargs-2.1 {object type conversion / display} -body { set spec1 {-a -- x {y Y} args} set spec2 $spec1 ns_parseargs $spec1 X ns_parseargs $spec2 X set spec1 $spec2 ns_parseargs $spec1 X ns_parseargs $spec2 X set spec2 "" set spec2 $spec1 ns_parseargs $spec2 X string equal $spec1 $spec2 } -cleanup { unset -nocomplain -- spec1 spec2 x y args } -result 1 test ns_parseargs-2.2 {object type conversion / display} -body { ns_parseargs a a } -cleanup { unset -nocomplain a } -result {} test ns_parseargs-3.1 {Arguments} -body { ns_parseargs {x y args} {1 2 3 4 5} list $x $y $args } -cleanup { unset -nocomplain -- x y args } -result [list 1 2 [list 3 4 5]] test ns_parseargs-4.1 {Options} -body { ns_parseargs {-a -b -c -d -e} {-b B -d D} list [info exists a] $b [info exists c] $d [info exists e] } -cleanup { unset -nocomplain -- a b c d e } -result [list 0 B 0 D 0] test ns_parseargs-5.1 {Defaults} -body { ns_parseargs {{-a A} -- x {y Y} {args {1 2 3}}} {X} list $a $x $y $args } -cleanup { unset -nocomplain -- a x y args } -result [list A X Y [list 1 2 3]] test ns_parseargs-5.2 {Defaults} -body { ns_parseargs {{-a A} -- x {y Y} {args {1 2 3}}} {-a aaa -- xxx yyy 3 2 1} list $a $x $y $args } -cleanup { unset -nocomplain -- a x y args } -result [list aaa xxx yyy [list 3 2 1]] test ns_parseargs-6.1 {-- ends option parsing} -body { ns_parseargs {-a -- x} {-a A -- X} list $a $x } -cleanup { unset -nocomplain -- a x } -result [list A X] test ns_parseargs-6.2 {-- ends option parsing} -body { ns_parseargs {-a -- x} {-a A X} list $a $x } -cleanup { unset -nocomplain -- a x } -result [list A X] test ns_parseargs-6.1 {-- ends option parsing} -body { ns_parseargs {-a x} {-a A X} list $a $x } -cleanup { unset -nocomplain -- a x } -result [list A X] test ns_parseargs-7.1 {Bad Args} -body { ns_parseargs {-a x} {} } -returnCodes error -result {wrong # args: should be "?-a a? x"} test ns_parseargs-7.2 {Bad Args} -body { ns_parseargs {-a x} {x y} } -returnCodes error -result {wrong # args: should be "?-a a? x"} test ns_parseargs-7.3 {Bad Args} -body { ns_parseargs {-a x} {-b x} } -returnCodes error -result {wrong # args: should be "?-a a? x"} test ns_parseargs-7.4 {Bad Args} -body { ns_parseargs {-a x} {-a a -- x} } -returnCodes error -result {wrong # args: should be "?-a a? x"} cleanupTests |
From: Stephen D. <sd...@us...> - 2005-03-26 14:25:33
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3873/include Modified Files: ns.h Log Message: * include/ns.h: * nsd/nsd.h: * nsd/tclobjv.c: * nsd/tclcmds.c: * tests/ns_parseargs.test: Change the signature of Ns_ObjvProc()s to return either TCL_OK, TCL_ERROR or TCL_BREAK. Fixes a bug where options were being double-counted as args. Also simplified the Ns_ObjvProc interface by passing the Ns_ObjvSpec directly. Added a new Tcl command: ns_parseargs specification args. It parses options, args and handles defaults. * nsd/tclobj.c: Added some wrapper procs for handling Tcl obj types. * nsd/tclinit.c: Added Ns_TclPrintfResult() as a convenience for writing ints into a formatted string result. Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ns.h 24 Mar 2005 01:17:55 -0000 1.9 --- ns.h 26 Mar 2005 14:25:16 -0000 1.10 *************** *** 286,291 **** typedef int (Ns_LogFlushProc) (char *msg, size_t len); typedef int (Ns_LogProc) (Ns_DString *dsPtr, Ns_LogSeverity severity, char *fmt, va_list ap); ! typedef int (Ns_ObjvProc) (void *dest, Tcl_Interp *interp, ! int objc, Tcl_Obj *CONST objv[], void *arg); /* --- 286,293 ---- typedef int (Ns_LogFlushProc) (char *msg, size_t len); typedef int (Ns_LogProc) (Ns_DString *dsPtr, Ns_LogSeverity severity, char *fmt, va_list ap); ! struct Ns_ObjvSpec; ! typedef int (Ns_ObjvProc) (struct Ns_ObjvSpec *spec, Tcl_Interp *interp, ! int *objcPtr, Tcl_Obj *CONST objv[]); ! /* *************** *** 783,790 **** --- 785,799 ---- NS_EXTERN void Ns_GenSeeds(unsigned long *seedsPtr, int nseeds); NS_EXTERN double Ns_DRand(void); + /* * tclobj.c: */ + NS_EXTERN void Ns_TclResetObjType(Tcl_Obj *objPtr, Tcl_ObjType *newTypePtr); + NS_EXTERN void Ns_TclSetTwoPtrValue(Tcl_Obj *objPtr, Tcl_ObjType *newTypePtr, + void *ptr1, void *ptr2); + NS_EXTERN void Ns_TclSetOtherValuePtr(Tcl_Obj *objPtr, Tcl_ObjType *newTypePtr, + void *value); + NS_EXTERN void Ns_TclSetStringRep(Tcl_Obj *objPtr, char *bytes, int length); NS_EXTERN void Ns_TclSetTimeObj(Tcl_Obj *objPtr, Ns_Time *timePtr); NS_EXTERN int Ns_TclGetTimeFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ns_Time *timePtr); *************** *** 1162,1165 **** --- 1171,1175 ---- NS_EXTERN int Ns_TclInit(Tcl_Interp *interp); + NS_EXTERN void Ns_TclPrintfResult(Tcl_Interp *interp, char *fmt, ...); NS_EXTERN int Nsd_Init(Tcl_Interp *interp); NS_EXTERN int Ns_TclInitInterps(char *server, Ns_TclInterpInitProc *proc, void *arg); |
From: Vlad S. <ser...@us...> - 2005-03-24 01:18:53
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26345/include Modified Files: ns.h Log Message: Make Ns_SockBindUdp public, it is already public in nsd/binder.c Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ns.h 8 Mar 2005 04:59:38 -0000 1.8 --- ns.h 24 Mar 2005 01:17:55 -0000 1.9 *************** *** 1085,1088 **** --- 1085,1089 ---- NS_EXTERN SOCKET Ns_SockListenRaw(int proto); NS_EXTERN SOCKET Ns_SockListenUnix(char *path); + NS_EXTERN SOCKET Ns_SockBindUdp(struct sockaddr_in *saPtr); /* |
From: Vlad S. <ser...@us...> - 2005-03-24 01:18:51
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26345 Modified Files: ChangeLog Log Message: Make Ns_SockBindUdp public, it is already public in nsd/binder.c Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ChangeLog 22 Mar 2005 20:49:29 -0000 1.25 --- ChangeLog 24 Mar 2005 01:17:54 -0000 1.26 *************** *** 1,2 **** --- 1,7 ---- + 2005-03-23 Vlad Seryakov <vl...@cr...> + + include/ns.h: Make Ns_SockBindUdp public function, it is public in + nsd/binder.c already. + 2005-03-22 Vlad Seryakov <vl...@cr...> |
From: Vlad S. <ser...@us...> - 2005-03-22 20:49:45
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8619 Modified Files: ChangeLog Log Message: Ensure that socket driver's DriverClose callback gets executed when the socket is released. This was causing a memory leak for HTTPS connections with nsopenssl when a Keep-Alive HTTP request timed out. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ChangeLog 18 Mar 2005 08:34:59 -0000 1.24 --- ChangeLog 22 Mar 2005 20:49:29 -0000 1.25 *************** *** 1,2 **** --- 1,9 ---- + 2005-03-22 Vlad Seryakov <vl...@cr...> + + nsd/driver.c: Ensure that socket driver's DriverClose callback + gets executed when the socket is released. This was causing a + memory leak for HTTPS connections with nsopenssl when a Keep-Alive + HTTP request timed out. Closes SF Bug #1160850 from AOLServer. + 2005-03-18 Zoran Vasiljevic <vas...@us...> |
From: Vlad S. <ser...@us...> - 2005-03-22 20:49:43
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8619/nsd Modified Files: driver.c Log Message: Ensure that socket driver's DriverClose callback gets executed when the socket is released. This was causing a memory leak for HTTPS connections with nsopenssl when a Keep-Alive HTTP request timed out. Index: driver.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/driver.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** driver.c 16 Feb 2005 08:39:47 -0000 1.1.1.1 --- driver.c 22 Mar 2005 20:49:31 -0000 1.2 *************** *** 1319,1322 **** --- 1319,1324 ---- } + (*sockPtr->drvPtr->proc)(DriverClose, sockPtr, NULL, 0); + --nactive; ns_sockclose(sockPtr->sock); |
From: Zoran V. <vas...@us...> - 2005-03-18 08:35:08
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16861 Modified Files: ChangeLog Log Message: See file Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ChangeLog 18 Mar 2005 08:24:40 -0000 1.23 --- ChangeLog 18 Mar 2005 08:34:59 -0000 1.24 *************** *** 7,14 **** touched any more. * nsd/nsd.h: * nsd/return.c: ! * nsd/server.c: Removed handling of aolpress config ! parameter (RFE #1165562) 2005-03-17 Zoran Vasiljevic <vas...@us...> --- 7,14 ---- touched any more. + * tcl/fastpath.tcl: * nsd/nsd.h: * nsd/return.c: ! * nsd/server.c: Removed handling of aolpress (RFE #1165562) 2005-03-17 Zoran Vasiljevic <vas...@us...> |