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: Stephen D. <sd...@us...> - 2005-12-30 11:07:44
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32584/tests Added Files: ns_cache.test Log Message: 2005-12-30 Stephen Deasey <sd...@us...> * include/ns.h: * nsd/nsd.h: * nsd/init.c: * nsd/proc.c: * nsd/cache.c: Global hash of cache names removed; access no longer available via Ns_CacheFind() or ns_cache_names. Caches have unique locking requirements and lifetimes which could be violated by e.g. running ns_cache_stats on a thread local cache as the thread is exiting. New Ns_CacheCreateEx() allows creating a cache which has both a size and a time limit. Caches with time limits are calculated differently. Previous behaviour was to periodically check the last access time of each cache entry and flush those which had expired. A busy cache could grow without bound. New behaviour is to check for expirey each time an entry is retrieved from the cache. All caches can (and should) be size limited. Timeouts may be specified per cache and per entry using new Ns_CacheSetValueExpires(). Ns_CacheFlush() now returns the number of entries flushed. New Ns_CacheStats() takes over from ns_cache_stats for non-Tcl caches. Stats are returned in Tcl "array get" format. Removed Ns_CacheMalloc(), Ns_CacheFree() and Ns_CacheName(). Move Tcl commands to tclcache.c. * nsd/Makefile: * nsd/tclcmds.c: * nsd/tclcache.c: * tests/ns_cache.test: Add new Tcl commands ns_cache_create, _eval, _append, _lappend, and _incr. (RFE# 1119257) Old commands ns_cache_names, _keys, _flush and _stats now only work on Tcl caches. ns_cache_size has been removed; the size is now reported along with other statistics. These commands now only work on Tcl caches. * tcl/cache.tcl: New ns_memoize and related commands which act just like ns_cache_eval but use the script as a key into the memoize cache. --- NEW FILE: ns_cache.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_cache.test,v 1.1 2005/12/30 11:07:34 sdeasey Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv ns_cache_create c1 1024 ns_cache_create c2 [expr 1024 * 1024] test cache-1.1 {basic syntax} -body { ns_cache_keys } -returnCodes error -result {wrong # args: should be "ns_cache_keys cache ?pattern?"} test cache-1.2 {basic syntax} -body { ns_cache_flush } -returnCodes error -result {wrong # args: should be "ns_cache_flush ?-glob? ?--? cache ?args?"} test cache-1.3 {basic syntax} -body { ns_cache_stats } -returnCodes error -result {wrong # args: should be "ns_cache_stats cache"} test cache-1.4 {basic syntax} -body { ns_cache_create } -returnCodes error -result {wrong # args: should be "ns_cache_create ?-ttl ttl? ?--? cache size"} test cache-1.5 {basic syntax} -body { ns_cache_eval } -returnCodes error -result {wrong # args: should be "ns_cache_eval ?-timeout timeout? ?-ttl ttl? ?--? cache key args"} test cache-1.6 {basic syntax} -body { ns_cache_incr } -returnCodes error -result {wrong # args: should be "ns_cache_incr ?-timeout timeout? ?-ttl ttl? ?--? cache key ?incr?"} test cache-1.7 {basic syntax} -body { ns_cache_append } -returnCodes error -result {wrong # args: should be "ns_cache_append ?-timeout timeout? ?-ttl ttl? ?--? cache key args"} test cache-1.8 {basic syntax} -body { ns_cache_lappend } -returnCodes error -result {wrong # args: should be "ns_cache_lappend ?-timeout timeout? ?-ttl ttl? ?--? cache key args"} test cache-1.9 {basic syntax} -body { ns_memoize } -returnCodes error -result {wrong # args: should be "?-timeout timeout? ?-ttl ttl? ?--? script ?args?"} test cache-2.1 {cache names} -body { lsort [ns_cache_names] } -result {c1 c2 ns:memoize} test cache-3.1 {cache create} -body { ns_cache_create -ttl 3 -- c3 1024 } -result {} test cache-4.1 {cache keys} -body { ns_cache_keys noexist } -returnCodes error -result {no such cache: noexist} test cache-4.2 {cache keys} -body { ns_cache_keys c1 } -result {} test cache-4.3 {cache keys} -body { ns_cache_eval c1 k1 {return a} ns_cache_keys c1 } -cleanup { ns_cache_flush c1 } -result k1 test cache-4.4 {cache keys} -body { ns_cache_eval c1 k1 {return a} ns_cache_eval c1 k2 {return a} lsort [ns_cache_keys c1] } -cleanup { ns_cache_flush c1 } -result {k1 k2} test cache-5.1 {cache flush} -body { ns_cache_flush c1 ns_cache_flush c1 } -result 0 test cache-5.2 {cache flush} -body { ns_cache_eval c1 k1 {return a} ns_cache_eval c1 k2 {return a} ns_cache_flush c1 } -result 2 test cache-5.3 {cache flush} -body { ns_cache_eval c1 k1 {return a} ns_cache_eval c1 k2 {return a} ns_cache_flush c1 k1 ns_cache_keys c1 } -cleanup { ns_cache_flush c1 } -result k2 test cache-5.4 {cache flush multiple keys} -body { ns_cache_eval c1 k1 {return a} ns_cache_eval c1 k2 {return a} ns_cache_flush c1 k1 k2 ns_cache_keys c1 } -cleanup { ns_cache_flush c1 } -result {} test cache-5.5 {cache flush glob keys} -body { ns_cache_eval c1 kx1 {return a} ns_cache_eval c1 kx2 {return a} ns_cache_eval c1 ky3 {return a} ns_cache_flush -glob c1 kx* ns_cache_keys c1 } -cleanup { ns_cache_flush c1 } -result ky3 test cache-5.6 {cache flush multiple glob keys} -body { ns_cache_eval c1 kx1 {return a} ns_cache_eval c1 kx2 {return a} ns_cache_eval c1 ky3 {return a} ns_cache_flush -glob c1 kx1 kx* ns_cache_keys c1 } -cleanup { ns_cache_flush c1 } -result ky3 test cache-6.1 {eval with args} -body { ns_cache_eval c1 k1 concat a b c } -cleanup { ns_cache_flush c1 } -result {a b c} test cache-6.2 {eval timeout switch} -body { ns_cache_eval -timeout 1 -- c1 k1 {return a} } -cleanup { ns_cache_flush c1 } -result a test cache-6.2 {eval ttl} -body { ns_cache_eval -ttl 1 -- c1 k1 {return a} after 1500 ns_cache_eval c1 k1 {return b} } -cleanup { ns_cache_flush c1 } -result b test cache-7.1 {cache stats} -body { array set stats [ns_cache_stats c1] lsort [array names stats] } -cleanup { unset -nocomplain stats } -result {entries flushed hitrate hits maxsize missed size} test cache-8.1 {cache incr} -body { ns_cache_incr c1 k1 } -cleanup { ns_cache_flush c1 } -result 1 test cache-8.2 {cache incr} -body { ns_cache_incr c1 k1 ns_cache_incr c1 k1 } -cleanup { ns_cache_flush c1 } -result 2 test cache-8.3 {cache incr: negative number} -body { ns_cache_incr c1 k1 -1 } -cleanup { ns_cache_flush c1 } -result -1 test cache-8.4 {cache incr: positive multiple} -body { ns_cache_incr c1 k1 2 } -cleanup { ns_cache_flush c1 } -result 2 test cache-9.1 {cache append} -body { ns_cache_append c1 k1 a ns_cache_append c1 k1 b } -cleanup { ns_cache_flush c1 } -result ab test cache-9.2 {cache append multiple values} -body { ns_cache_append c1 k1 a ns_cache_append c1 k1 b c } -cleanup { ns_cache_flush c1 } -result {abc} test cache-9.4 {cache lappend} -body { ns_cache_lappend c1 k1 a ns_cache_lappend c1 k1 b } -cleanup { ns_cache_flush c1 } -result {a b} test cache-9.5 {cache lappend multiple values} -body { ns_cache_lappend c1 k1 a ns_cache_lappend c1 k1 b c } -cleanup { ns_cache_flush c1 } -result {a b c} test cache-10.1 {memoize} -body { ns_memoize {return a} } -cleanup { ns_memoize_flush } -result a test cache-10.2 {memoize with multiple args} -body { ns_memoize return b } -cleanup { ns_memoize_flush } -result b test cache-10.3 {memoize timeout} -body { ns_memoize -timeout 2 -- {return c} } -cleanup { ns_memoize_flush } -result c test cache-10.4 {memoize flush} -body { ns_memoize {return d} ns_memoize_flush {return d} } -cleanup { ns_memoize_flush } -result 1 test cache-10.5 {memoize flush glob} -body { ns_memoize return e1 ns_memoize return e2 ns_memoize return f1 ns_memoize_flush {return e*} } -cleanup { ns_memoize_flush } -result 2 test ns_cache-11.1 {stability} -body { for {set i 0} {$i < 100} {incr i} { ns_thread begindetached " for {set j 0} {\$j < 1000} {incr j} { for {set x 0} {\$x < 10000} {incr x} {set a b} ns_cache_eval c1 k1 {return a} ns_thread yield } " } ns_thread begindetached { for {set j 0} {$j < 1000} {incr j} { for {set x 0} {$x < 10000} {incr x} {set a b} ns_cache_flush c1 ns_thread yield } } ns_log notice [ns_cache_stats c1] } -cleanup { unset -nocomplain i j ns_cache_flush c1 } -result {} cleanupTests |
From: Stephen D. <sd...@us...> - 2005-12-30 11:07:42
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32584 Modified Files: ChangeLog Log Message: 2005-12-30 Stephen Deasey <sd...@us...> * include/ns.h: * nsd/nsd.h: * nsd/init.c: * nsd/proc.c: * nsd/cache.c: Global hash of cache names removed; access no longer available via Ns_CacheFind() or ns_cache_names. Caches have unique locking requirements and lifetimes which could be violated by e.g. running ns_cache_stats on a thread local cache as the thread is exiting. New Ns_CacheCreateEx() allows creating a cache which has both a size and a time limit. Caches with time limits are calculated differently. Previous behaviour was to periodically check the last access time of each cache entry and flush those which had expired. A busy cache could grow without bound. New behaviour is to check for expirey each time an entry is retrieved from the cache. All caches can (and should) be size limited. Timeouts may be specified per cache and per entry using new Ns_CacheSetValueExpires(). Ns_CacheFlush() now returns the number of entries flushed. New Ns_CacheStats() takes over from ns_cache_stats for non-Tcl caches. Stats are returned in Tcl "array get" format. Removed Ns_CacheMalloc(), Ns_CacheFree() and Ns_CacheName(). Move Tcl commands to tclcache.c. * nsd/Makefile: * nsd/tclcmds.c: * nsd/tclcache.c: * tests/ns_cache.test: Add new Tcl commands ns_cache_create, _eval, _append, _lappend, and _incr. (RFE# 1119257) Old commands ns_cache_names, _keys, _flush and _stats now only work on Tcl caches. ns_cache_size has been removed; the size is now reported along with other statistics. These commands now only work on Tcl caches. * tcl/cache.tcl: New ns_memoize and related commands which act just like ns_cache_eval but use the script as a key into the memoize cache. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.261 retrieving revision 1.262 diff -C2 -d -r1.261 -r1.262 *** ChangeLog 23 Dec 2005 04:27:22 -0000 1.261 --- ChangeLog 30 Dec 2005 11:07:33 -0000 1.262 *************** *** 1,2 **** --- 1,49 ---- + 2005-12-30 Stephen Deasey <sd...@us...> + + * include/ns.h: + * nsd/nsd.h: + * nsd/init.c: + * nsd/proc.c: + * nsd/cache.c: Global hash of cache names removed; access no + longer available via Ns_CacheFind() or ns_cache_names. Caches + have unique locking requirements and lifetimes which could be + violated by e.g. running ns_cache_stats on a thread local cache as the + thread is exiting. + + New Ns_CacheCreateEx() allows creating a cache which has both a + size and a time limit. + + Caches with time limits are calculated differently. Previous + behaviour was to periodically check the last access time of each + cache entry and flush those which had expired. A busy cache could + grow without bound. New behaviour is to check for expirey each time + an entry is retrieved from the cache. All caches can (and should) + be size limited. Timeouts may be specified per cache and per + entry using new Ns_CacheSetValueExpires(). + + Ns_CacheFlush() now returns the number of entries flushed. + + New Ns_CacheStats() takes over from ns_cache_stats for non-Tcl + caches. Stats are returned in Tcl "array get" format. + + Removed Ns_CacheMalloc(), Ns_CacheFree() and Ns_CacheName(). + + Move Tcl commands to tclcache.c. + + * nsd/Makefile: + * nsd/tclcmds.c: + * nsd/tclcache.c: + * tests/ns_cache.test: Add new Tcl commands ns_cache_create, + _eval, _append, _lappend, and _incr. (RFE# 1119257) + + Old commands ns_cache_names, _keys, _flush and _stats now only + work on Tcl caches. ns_cache_size has been removed; the size is + now reported along with other statistics. These commands now only + work on Tcl caches. + + * tcl/cache.tcl: New ns_memoize and related commands which act + just like ns_cache_eval but use the script as a key into the + memoize cache. + 2005-12-22 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-12-23 04:27:31
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15560 Modified Files: ChangeLog Log Message: * nsd/tclrequest.c: * tests/ns_register_filter.test: * tests/ns_info.test: Fix bug where blank arg was being passed to filter and trace procs when no arg was registered. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.260 retrieving revision 1.261 diff -C2 -d -r1.260 -r1.261 *** ChangeLog 11 Dec 2005 11:19:49 -0000 1.260 --- ChangeLog 23 Dec 2005 04:27:22 -0000 1.261 *************** *** 1,2 **** --- 1,9 ---- + 2005-12-22 Stephen Deasey <sd...@us...> + + * nsd/tclrequest.c: + * tests/ns_register_filter.test: + * tests/ns_info.test: Fix bug where blank arg was being passed to + filter and trace procs when no arg was registered. + 2005-12-11 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-12-23 04:27:31
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15560/nsd Modified Files: tclrequest.c Log Message: * nsd/tclrequest.c: * tests/ns_register_filter.test: * tests/ns_info.test: Fix bug where blank arg was being passed to filter and trace procs when no arg was registered. Index: tclrequest.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclrequest.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tclrequest.c 11 Dec 2005 11:19:50 -0000 1.10 --- tclrequest.c 23 Dec 2005 04:27:22 -0000 1.11 *************** *** 104,108 **** NsInterp *itPtr = arg; Ns_TclCallback *cbPtr; ! char *method, *url, *script, *scriptarg = ""; int flags = 0; --- 104,108 ---- NsInterp *itPtr = arg; Ns_TclCallback *cbPtr; ! char *method, *url, *script, *scriptarg = NULL; int flags = 0; *************** *** 290,294 **** NsInterp *itPtr = arg; Ns_TclCallback *cbPtr; ! char *method, *urlPattern, *script, *scriptarg = ""; int when = 0; --- 290,294 ---- NsInterp *itPtr = arg; Ns_TclCallback *cbPtr; ! char *method, *urlPattern, *script, *scriptarg = NULL; int when = 0; *************** *** 486,494 **** /* ! * Start building the command with the script and arg. */ Tcl_DStringAppend(&cmd, cbPtr->script, -1); ! Tcl_DStringAppendElement(&cmd, cbPtr->scriptarg); /* --- 486,497 ---- /* ! * This really should be: cmd why ?arg?, but why and arg ! * are reversed for backwards compatibility. */ Tcl_DStringAppend(&cmd, cbPtr->script, -1); ! if (cbPtr->scriptarg != NULL) { ! Tcl_DStringAppendElement(&cmd, cbPtr->scriptarg); ! } /* *************** *** 506,509 **** --- 509,515 ---- Tcl_DStringAppendElement(&cmd, "trace"); break; + case NS_FILTER_VOID_TRACE: + /* Registered with ns_register_trace; always type VOID TRACE, so don't append. */ + break; } *************** *** 534,538 **** status = NS_FILTER_RETURN; } else { ! Ns_Log(Warning, "tclfilter: %s return invalid result: %s", cbPtr->script, result); status = NS_ERROR; --- 540,544 ---- status = NS_FILTER_RETURN; } else { ! Ns_Log(Error, "tclfilter: %s return invalid result: %s", cbPtr->script, result); status = NS_ERROR; |
From: Stephen D. <sd...@us...> - 2005-12-23 04:27:31
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15560/tests Modified Files: ns_info.test ns_register_filter.test Log Message: * nsd/tclrequest.c: * tests/ns_register_filter.test: * tests/ns_info.test: Fix bug where blank arg was being passed to filter and trace procs when no arg was registered. Index: ns_register_filter.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_register_filter.test,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ns_register_filter.test 11 Dec 2005 11:19:50 -0000 1.2 --- ns_register_filter.test 23 Dec 2005 04:27:22 -0000 1.3 *************** *** 168,170 **** --- 168,222 ---- + test filter-6.1 {no filter scriptarg} -setup { + ns_register_filter preauth GET /filter-6.1 { + nsv_lappend . . } + } -body { + ns_logctl severity Error off + nstest_http -getbody 1 GET /filter-6.1 + ns_logctl severity Error on + nsv_get . . + } -cleanup { + nsv_unset -nocomplain . . + } -result {preauth} + + test filter-6.2 {filter scriptarg} -setup { + ns_register_filter preauth GET /filter-6.2 { + nsv_lappend . . } x + } -body { + ns_logctl severity Error off + nstest_http -getbody 1 GET /filter-6.2 + ns_logctl severity Error on + nsv_get . . + } -cleanup { + nsv_unset -nocomplain . . + } -result {x preauth} + + test filter-6.3 {no trace scriptarg} -setup { + ns_register_trace GET /trace-6.3 { + nsv_lappend . . ignore } + } -body { + ns_logctl severity Error on + nstest_http -getbody 1 GET /trace-6.3 + ns_logctl severity Error on + after 2500 + nsv_get . . + } -cleanup { + nsv_unset -nocomplain . . + } -result {ignore} + + test filter-6.4 {trace scriptarg} -setup { + ns_register_trace GET /trace-6.4 { + nsv_lappend . . ignore } x + } -body { + ns_logctl severity Error on + nstest_http -getbody 1 GET /trace-6.4 + ns_logctl severity Error on + after 2500 + nsv_get . . + } -cleanup { + nsv_unset -nocomplain . . + } -result {ignore x} + + + cleanupTests Index: ns_info.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_info.test,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ns_info.test 4 Dec 2005 01:53:01 -0000 1.6 --- ns_info.test 23 Dec 2005 04:27:22 -0000 1.7 *************** *** 158,167 **** test ns_info-2.31.2 {basic operation} -setup { proc _filter_do_nothing {args} { ! return "" } ! ns_register_filter preauth GET / _filter_do_nothing } -body { ns_info filters ! } -result {{GET / preauth ns:tclfilter _filter_do_nothing {}}} --- 158,167 ---- test ns_info-2.31.2 {basic operation} -setup { proc _filter_do_nothing {args} { ! return filter_ok } ! ns_register_filter preauth GET /ns_info-2.31.2 _filter_do_nothing } -body { ns_info filters ! } -match glob -result {*{GET /ns_info-2.31.2 preauth ns:tclfilter _filter_do_nothing}*} |
From: Stephen D. <sd...@us...> - 2005-12-11 11:20:00
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31847/nsd Modified Files: filter.c nsd.h proc.c tclcmds.c tclrequest.c Log Message: * include/ns.h: * nsd/nsd.h: * nsd/filter.c: * nsd/tclrequest.c: * nsd/proc.c: * nsd/tclcmds.c: * tests/ns_register_filter.test: Add switch -first to ns_register_filter command, allowing filters to be registered at the head of the queue. Add new command ns_shortcut_filter which registers a C filter callback which simply returns NS_FILTER_BREAK, preventing any other filters of the same type from running. For further explanation, see: http://sf.net/tracker/index.php?func=detail&aid=1012103&group_id=3152&atid=353152 Index: tclcmds.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclcmds.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tclcmds.c 11 Dec 2005 04:44:05 -0000 1.26 --- tclcmds.c 11 Dec 2005 11:19:50 -0000 1.27 *************** *** 158,161 **** --- 158,162 ---- NsTclSetCookieObjCmd, NsTclSetObjCmd, + NsTclShortcutFilterObjCmd, NsTclShutdownObjCmd, NsTclSleepObjCmd, *************** *** 308,311 **** --- 309,313 ---- {"ns_set", NULL, NsTclSetObjCmd}, {"ns_sha1", NULL, NsTclSHA1ObjCmd}, + {"ns_shortcut_filter", NULL, NsTclShortcutFilterObjCmd}, {"ns_sleep", NULL, NsTclSleepObjCmd}, {"ns_sockaccept", NULL, NsTclSockAcceptObjCmd}, Index: nsd.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsd.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** nsd.h 11 Dec 2005 04:44:05 -0000 1.40 --- nsd.h 11 Dec 2005 11:19:50 -0000 1.41 *************** *** 880,883 **** --- 880,884 ---- extern Ns_ArgProc NsConnArgProc; extern Ns_FilterProc NsTclFilterProc; + extern Ns_FilterProc NsShortcutFilterProc; extern Ns_OpProc NsFastPathProc; extern Ns_OpProc NsTclRequestProc; Index: filter.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/filter.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filter.c 10 Jun 2005 17:58:38 -0000 1.3 --- filter.c 11 Dec 2005 11:19:50 -0000 1.4 *************** *** 96,105 **** fPtr->when = when; fPtr->arg = arg; ! fPtr->nextPtr = NULL; ! fPtrPtr = &servPtr->filter.firstFilterPtr; ! while (*fPtrPtr != NULL) { ! fPtrPtr = &((*fPtrPtr)->nextPtr); } - *fPtrPtr = fPtr; return (void *) fPtr; } --- 96,110 ---- fPtr->when = when; fPtr->arg = arg; ! if (when & NS_FILTER_FIRST) { ! fPtr->nextPtr = servPtr->filter.firstFilterPtr; ! servPtr->filter.firstFilterPtr = fPtr; ! } else { ! fPtr->nextPtr = NULL; ! fPtrPtr = &servPtr->filter.firstFilterPtr; ! while (*fPtrPtr != NULL) { ! fPtrPtr = &((*fPtrPtr)->nextPtr); ! } ! *fPtrPtr = fPtr; } return (void *) fPtr; } Index: proc.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/proc.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** proc.c 11 Dec 2005 04:44:05 -0000 1.10 --- proc.c 11 Dec 2005 11:19:50 -0000 1.11 *************** *** 77,80 **** --- 77,81 ---- {(void *) NsConnThread, "ns:connthread", NsConnArgProc}, {(void *) NsTclFilterProc, "ns:tclfilter", Ns_TclCallbackArgProc}, + {(void *) NsShortcutFilterProc, "ns:shortcutfilter", NULL}, {(void *) NsTclRequestProc, "ns:tclrequest", Ns_TclCallbackArgProc}, {(void *) NsAdpRequestProc, "ns:adprequest", ServerArgProc}, Index: tclrequest.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclrequest.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tclrequest.c 11 Dec 2005 10:17:59 -0000 1.9 --- tclrequest.c 11 Dec 2005 11:19:50 -0000 1.10 *************** *** 293,296 **** --- 293,301 ---- int when = 0; + Ns_ObjvSpec opts[] = { + {"-first", Ns_ObjvBool, &when, (void *) NS_FILTER_FIRST}, + {"--", Ns_ObjvBreak, NULL, NULL}, + {NULL, NULL, NULL, NULL} + }; Ns_ObjvSpec args[] = { {"when", Ns_ObjvFlags, &when, filters}, *************** *** 301,305 **** {NULL, NULL, NULL, NULL} }; ! if (Ns_ParseObjv(NULL, args, interp, 1, objc, objv) != NS_OK) { return TCL_ERROR; } --- 306,310 ---- {NULL, NULL, NULL, NULL} }; ! if (Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) { return TCL_ERROR; } *************** *** 316,319 **** --- 321,365 ---- *---------------------------------------------------------------------- * + * NsTclShortcutFilterObjCmd -- + * + * Implements ns_shortcut_filter. + * + * Results: + * Tcl result. + * + * Side effects: + * Other filters that also match when+method+urlPattern will not run. + * + *---------------------------------------------------------------------- + */ + + int + NsTclShortcutFilterObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) + { + NsInterp *itPtr = arg; + char *server = itPtr->servPtr->server; + char *method, *urlPattern; + int when = NS_FILTER_FIRST; + + Ns_ObjvSpec args[] = { + {"when", Ns_ObjvFlags, &when, filters}, + {"method", Ns_ObjvString, &method, NULL}, + {"urlPattern", Ns_ObjvString, &urlPattern, NULL}, + {NULL, NULL, NULL, NULL} + }; + if (Ns_ParseObjv(NULL, args, interp, 1, objc, objv) != NS_OK) { + return TCL_ERROR; + } + + Ns_RegisterFilter(server, method, urlPattern, + NsShortcutFilterProc, when, NULL); + + return TCL_OK; + } + + + /* + *---------------------------------------------------------------------- + * * NsTclRegisterTraceObjCmd -- * *************** *** 496,497 **** --- 542,566 ---- return status; } + + + /* + *---------------------------------------------------------------------- + * + * NsShortcutFilterProc -- + * + * The callback for Tcl shortcut filters. + * + * Results: + * Always NS_FILTER_BREAK. + * + * Side effects: + * No other filters of this type will run for this connection. + * + *---------------------------------------------------------------------- + */ + + int + NsShortcutFilterProc(void *arg, Ns_Conn *conn, int why) + { + return NS_FILTER_BREAK; + } |
From: Stephen D. <sd...@us...> - 2005-12-11 11:19:59
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31847/tests Modified Files: ns_register_filter.test Log Message: * include/ns.h: * nsd/nsd.h: * nsd/filter.c: * nsd/tclrequest.c: * nsd/proc.c: * nsd/tclcmds.c: * tests/ns_register_filter.test: Add switch -first to ns_register_filter command, allowing filters to be registered at the head of the queue. Add new command ns_shortcut_filter which registers a C filter callback which simply returns NS_FILTER_BREAK, preventing any other filters of the same type from running. For further explanation, see: http://sf.net/tracker/index.php?func=detail&aid=1012103&group_id=3152&atid=353152 Index: ns_register_filter.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_register_filter.test,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ns_register_filter.test 11 Dec 2005 10:17:59 -0000 1.1 --- ns_register_filter.test 11 Dec 2005 11:19:50 -0000 1.2 *************** *** 13,17 **** test filter-1.1 {basic syntax} -body { ns_register_filter ! } -returnCodes error -result {wrong # args: should be "ns_register_filter when method urlPattern script ?arg?"} test filter-1.2 {basic syntax} -body { --- 13,17 ---- test filter-1.1 {basic syntax} -body { ns_register_filter ! } -returnCodes error -result {wrong # args: should be "ns_register_filter ?-first? ?--? when method urlPattern script ?arg?"} test filter-1.2 {basic syntax} -body { *************** *** 147,149 **** --- 147,170 ---- + test filter-5.1 {filter -first} -setup { + ns_register_filter preauth GET /filter-5.1 { + nsv_lappend . . filter-5.1-1 + return filter_ok + ;# } + ns_register_filter -first preauth GET /filter-5.1 { + nsv_lappend . . filter-5.1-2 + return filter_ok + ;# } + ns_register_proc GET /filter-5.1 { + ns_return 200 text/plain [nsv_get . .] + ;# } + } -body { + nstest_http -getbody 1 GET /filter-5.1 + } -cleanup { + nsv_unset -nocomplain . . + ns_unregister_proc GET /filter-5.1 + } -result {200 {filter-5.1-2 filter-5.1-1}} + + + cleanupTests |
From: Stephen D. <sd...@us...> - 2005-12-11 11:19:58
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31847 Modified Files: ChangeLog Log Message: * include/ns.h: * nsd/nsd.h: * nsd/filter.c: * nsd/tclrequest.c: * nsd/proc.c: * nsd/tclcmds.c: * tests/ns_register_filter.test: Add switch -first to ns_register_filter command, allowing filters to be registered at the head of the queue. Add new command ns_shortcut_filter which registers a C filter callback which simply returns NS_FILTER_BREAK, preventing any other filters of the same type from running. For further explanation, see: http://sf.net/tracker/index.php?func=detail&aid=1012103&group_id=3152&atid=353152 Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.259 retrieving revision 1.260 diff -C2 -d -r1.259 -r1.260 *** ChangeLog 11 Dec 2005 10:17:59 -0000 1.259 --- ChangeLog 11 Dec 2005 11:19:49 -0000 1.260 *************** *** 16,19 **** --- 16,33 ---- fragments, rather than proc names. + * include/ns.h: + * nsd/nsd.h: + * nsd/filter.c: + * nsd/tclrequest.c: + * nsd/proc.c: + * nsd/tclcmds.c: + * tests/ns_register_filter.test: Add switch -first to + ns_register_filter command, allowing filters to be registered at + the head of the queue. Add new command ns_shortcut_filter + which registers a C filter callback which simply returns + NS_FILTER_BREAK, preventing any other filters of the same type + from running. For further explanation, see: + http://sf.net/tracker/index.php?func=detail&aid=1012103&group_id=3152&atid=353152 + 2005-12-10 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-12-11 11:19:58
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31847/include Modified Files: ns.h Log Message: * include/ns.h: * nsd/nsd.h: * nsd/filter.c: * nsd/tclrequest.c: * nsd/proc.c: * nsd/tclcmds.c: * tests/ns_register_filter.test: Add switch -first to ns_register_filter command, allowing filters to be registered at the head of the queue. Add new command ns_shortcut_filter which registers a C filter callback which simply returns NS_FILTER_BREAK, preventing any other filters of the same type from running. For further explanation, see: http://sf.net/tracker/index.php?func=detail&aid=1012103&group_id=3152&atid=353152 Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** ns.h 11 Dec 2005 04:44:04 -0000 1.63 --- ns.h 11 Dec 2005 11:19:50 -0000 1.64 *************** *** 105,108 **** --- 105,109 ---- #define NS_FILTER_TRACE 0x04 /* Runs after Ns_OpProc completes successfully */ #define NS_FILTER_VOID_TRACE 0x08 /* Run ns_register_trace procs after previous traces */ + #define NS_FILTER_FIRST 0x10 /* Register filter at head of queue. */ /* |
From: Stephen D. <sd...@us...> - 2005-12-11 10:18:10
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22267/tests Added Files: ns_register_filter.test Log Message: * tests/ns_register_filter.test: Add tests for registered filters and traces. * nsd/tclrequest.c: Fix bug where filter errors were being logged twice. Fix bug where filter callback procs were being constructed incorrectly, making it impossible to register inline script fragments, rather than proc names. --- NEW FILE: ns_register_filter.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_register_filter.test,v 1.1 2005/12/11 10:17:59 sdeasey Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test filter-1.1 {basic syntax} -body { ns_register_filter } -returnCodes error -result {wrong # args: should be "ns_register_filter when method urlPattern script ?arg?"} test filter-1.2 {basic syntax} -body { ns_register_filter when GET / aproc } -returnCodes error -result {bad flag "when": must be preauth, postauth, or trace} test filter-1.3 {basic syntax} -body { ns_register_trace } -returnCodes error -result {wrong # args: should be "ns_register_trace method urlPattern script ?arg?"} test filter-2.1 {correct order} -setup { ns_register_filter preauth GET /filter-2.1 { nsv_lappend . . preauth-2.1 return filter_ok ;# } ns_register_filter postauth GET /filter-2.1 { nsv_lappend . . postauth-2.1 return filter_ok ;# } ns_register_filter trace GET /filter-2.1 { nsv_lappend . . trace-2.1 return filter_ok ;# } ns_register_trace GET /filter-2.1 { nsv_lappend . . voidtrace-2.1 return filter_ok ;# } ns_register_proc GET /filter-2.1 {ns_return 200 text/plain ok ;#} } -body { set result [nstest_http -getbody 1 GET /filter-2.1] after 2000 list $result [nsv_get . .] } -cleanup { ns_unregister_proc GET /filter-2.1 nsv_unset -nocomplain . . } -result {{200 ok} {preauth-2.1 postauth-2.1 trace-2.1 voidtrace-2.1}} test filter-2.2 {stacked filters} -setup { ns_register_filter preauth GET /filter-2.2 { nsv_lappend . . preauth-2.2-1 return filter_ok ;# } ns_register_filter preauth GET /filter-2.2 { nsv_lappend . . preauth-2.2-2 return filter_ok ;# } ns_register_proc GET /filter-2.2 {ns_return 200 text/plain ok ;#} } -body { list [nstest_http -getbody 1 GET /filter-2.2] [nsv_get . .] } -cleanup { nsv_unset -nocomplain . . } -result {{200 ok} {preauth-2.2-1 preauth-2.2-2}} test filter-2.3 {void trace always runs} -setup { ns_register_filter preauth GET /filter-2.3 {error filter-2.3 ;#} ns_register_trace GET /filter-2.3 { nsv_lappend . . voidtrace-2.3 return filter_ok ;# } ns_register_proc GET /filter-2.3 {error filter-2.3 ;# } } -body { ns_logctl severity Error off set result [nstest_http GET /filter-2.3] ns_logctl severity Error on after 2000 ;# wait for conn thread to run trace code list $result [nsv_get . .] } -cleanup { nsv_unset -nocomplain . . ns_unregister_proc GET /filter-2.3 } -result {500 voidtrace-2.3} test filter-3.1 {return filter_break} -setup { ns_register_filter preauth GET /filter-3.1 { nsv_lappend . . filter_break-3.1 return filter_break ;# } ns_register_filter preauth GET /filter-3.1 { nsv_lappend . . filter_ok-3.1 return filter_ok ;# } ns_register_proc GET /filter-3.1 { ns_return 200 text/plain ok ;# } } -body { list [nstest_http -getbody 1 GET /filter-3.1] [nsv_get . .] } -cleanup { nsv_unset -nocomplain . . ns_unregister_proc GET /filter-3.1 } -result {{200 ok} filter_break-3.1} test filter-3.2 {return filter_return} -setup { ns_register_filter preauth GET /filter-3.2 { nsv_lappend . . filter_return-3.2 ns_return 200 text/plain filter_return return filter_return ;# } ns_register_filter preauth GET /filter-3.2 { nsv_lappend . . filter_ok-3.2 return filter_ok ;# } ns_register_proc GET /filter-3.2 { nsv_lappend . . proc-3.2 ns_return 200 text/plain ok ;# } } -body { list [nstest_http -getbody 1 GET /filter-3.2] [nsv_get . .] } -cleanup { nsv_unset -nocomplain . . ns_unregister_proc GET /filter-3.2 } -result {{200 filter_return} filter_return-3.2} test filter-4.1 {glob} -setup { ns_register_filter preauth GET /filter-4.1/*/literal/* { nsv_lappend . . filter-4.1 return filter_ok ;# } ns_register_proc GET /filter-4.1 { ns_return 200 text/plain [nsv_get . .] ;# } } -body { nstest_http -getbody 1 GET /filter-4.1/X/literal/Y] } -cleanup { nsv_unset -nocomplain . . ns_unregister_proc GET /filter-4.1 } -result {200 filter-4.1} cleanupTests |
From: Stephen D. <sd...@us...> - 2005-12-11 10:18:10
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22267/nsd Modified Files: tclrequest.c Log Message: * tests/ns_register_filter.test: Add tests for registered filters and traces. * nsd/tclrequest.c: Fix bug where filter errors were being logged twice. Fix bug where filter callback procs were being constructed incorrectly, making it impossible to register inline script fragments, rather than proc names. Index: tclrequest.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclrequest.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tclrequest.c 11 Dec 2005 04:44:05 -0000 1.8 --- tclrequest.c 11 Dec 2005 10:17:59 -0000 1.9 *************** *** 404,408 **** interp = Ns_GetConnInterp(conn); if (Ns_TclEvalCallback(interp, cbPtr, NULL, NULL) != TCL_OK) { - Ns_TclLogError(interp); return Ns_ConnReturnInternalError(conn); } --- 404,407 ---- *************** *** 444,448 **** */ ! Tcl_DStringAppendElement(&cmd, cbPtr->script); Tcl_DStringAppendElement(&cmd, cbPtr->scriptarg); --- 443,447 ---- */ ! Tcl_DStringAppend(&cmd, cbPtr->script, -1); Tcl_DStringAppendElement(&cmd, cbPtr->scriptarg); |
From: Stephen D. <sd...@us...> - 2005-12-11 10:18:10
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22267 Modified Files: ChangeLog Log Message: * tests/ns_register_filter.test: Add tests for registered filters and traces. * nsd/tclrequest.c: Fix bug where filter errors were being logged twice. Fix bug where filter callback procs were being constructed incorrectly, making it impossible to register inline script fragments, rather than proc names. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.258 retrieving revision 1.259 diff -C2 -d -r1.258 -r1.259 *** ChangeLog 11 Dec 2005 10:10:48 -0000 1.258 --- ChangeLog 11 Dec 2005 10:17:59 -0000 1.259 *************** *** 9,12 **** --- 9,19 ---- * tests/ns_nsv.test: Typo: s/-setup/-body/ + * tests/ns_register_filter.test: Add tests for registered filters + and traces. + * nsd/tclrequest.c: Fix bug where filter errors were being logged + twice. Fix bug where filter callback procs were being constructed + incorrectly, making it impossible to register inline script + fragments, rather than proc names. + 2005-12-10 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-12-11 10:11:00
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21183 Modified Files: ChangeLog Log Message: Typo: s/-setup/-body/ Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.257 retrieving revision 1.258 diff -C2 -d -r1.257 -r1.258 *** ChangeLog 11 Dec 2005 10:01:10 -0000 1.257 --- ChangeLog 11 Dec 2005 10:10:48 -0000 1.258 *************** *** 7,10 **** --- 7,12 ---- to match Tcl unset command. + * tests/ns_nsv.test: Typo: s/-setup/-body/ + 2005-12-10 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-12-11 10:10:57
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21183/tests Modified Files: ns_nsv.test Log Message: Typo: s/-setup/-body/ Index: ns_nsv.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_nsv.test,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ns_nsv.test 11 Dec 2005 10:01:11 -0000 1.2 --- ns_nsv.test 11 Dec 2005 10:10:48 -0000 1.3 *************** *** 205,209 **** } -result 1 ! test ns_nsv-4.10 {nsv_array exists} -setup { nsv_array exists noexists } -result 0 --- 205,209 ---- } -result 1 ! test ns_nsv-4.10 {nsv_array exists} -body { nsv_array exists noexists } -result 0 |
From: Stephen D. <sd...@us...> - 2005-12-11 10:01:23
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19572/tests Modified Files: ns_nsv.test Log Message: * nsd/tclvar.c: * tests/ns_nsv.test: Add -nocomplain switch to nsv_unset command to match Tcl unset command. Index: ns_nsv.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_nsv.test,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ns_nsv.test 17 Apr 2005 18:37:37 -0000 1.1 --- ns_nsv.test 11 Dec 2005 10:01:11 -0000 1.2 *************** *** 32,36 **** test ns_nsv-1.7 {basic syntax nsv_unset} -body { nsv_unset ! } -returnCodes error -result {wrong # args: should be "nsv_unset array ?key?"} test ns_nsv-1.8 {basic syntax nsv_array} -body { --- 32,36 ---- test ns_nsv-1.7 {basic syntax nsv_unset} -body { nsv_unset ! } -returnCodes error -result {wrong # args: should be "nsv_unset ?-nocomplain? ?--? array ?key?"} test ns_nsv-1.8 {basic syntax nsv_array} -body { *************** *** 38,42 **** } -returnCodes error -result {wrong # args: should be "nsv_array option ..."} ! test ns_nsv-1.9 {basic syntax nsv_names} -body { nsv_names zirrZarr } -result "" --- 38,46 ---- } -returnCodes error -result {wrong # args: should be "nsv_array option ..."} ! test ns_nsv-1.9 {basic syntax nsv_array} -body { ! nsv_array ? ! } -returnCodes error -result {bad option "?": must be set, reset, get, names, size, or exists} ! ! test ns_nsv-1.10 {basic syntax nsv_names} -body { nsv_names zirrZarr } -result "" *************** *** 44,402 **** - - test ns_nsv-2.1 {nsv_set a key} -body { ! nsv_set myarray foo bar ! } -result "bar" test ns_nsv-2.2 {nsv_set same key} -body { ! nsv_set myarray foo baz ! } -result "baz" test ns_nsv-2.3 {nsv_set an "integer" key} -body { ! nsv_set myarray 1 bar ! } -result "bar" test ns_nsv-2.4 {nsv_set key with spaces} -body { ! nsv_set myarray "and now to something different" foo ! } -result "foo" test ns_nsv-2.5 {nsv_set big value} -body { ! # set a meg ! nsv_set myarray twofive [string repeat "x" [expr {1024*1024}]] } -result [string repeat "x" [expr {1024*1024}]] - - - test ns_nsv-3.1 {nsv_unset too many args} -body { ! nsv_unset myarray foo bar baz ! } -returnCodes error -result {wrong # args: should be "nsv_unset array ?key?"} test ns_nsv-3.2 {nsv_unset key} -setup { ! nsv_set threetwo foo bar } -body { ! nsv_unset threetwo foo ! } -cleanup { ! if {[nsv_exists myarray threetwo]} { ! error "threetwo(threetwo) exists after nsv_unset" ! } ! } -result "" test ns_nsv-3.3 {nsv_unset an "integer" key} -setup { ! nsv_set threethree 1 bar } -body { ! nsv_unset threethree 1 ! } -cleanup { ! if {[nsv_exists threethree 1]} { ! error "threethree(1) exists after nsv_unset" ! } ! } -result "" test ns_nsv-3.4 {nsv_unset key with spaces} -setup { ! nsv_set threefour "and now to something different" bar } -body { ! nsv_unset threefour "and now to something different" ! } -cleanup { ! if {[nsv_exists threefour "and now to something different"]} { ! error "threefour(and now to something different) exists after nsv_unset" ! } ! } -result "" test ns_nsv-3.5 {nsv_unset array} -setup { ! nsv_set threefive a1 x ! nsv_set threefive a2 x ! nsv_set threefive a3 x ! nsv_set threefive a4 x ! nsv_set threefive a5 x } -body { ! nsv_unset threefive ! } -cleanup { ! # don't want to use nsv_array command here. ! foreach element [list a1 a2 a3 a4 a5] { ! if {[nsv_exists threefive $element]} { ! error "threefive($element) exists after 'nsv_unset threefive'" ! } ! } ! } -result "" - test ns_nsv-4.1 {nsv_array options} -body { - nsv_array zirrZarr - } -returnCodes error -result {bad option "zirrZarr": must be set, reset, get, names, size, or exists} ! test ns_nsv-4.2 {nsv_array set} -body { ! nsv_array set fourtwo { ! a 1 ! b 2 ! c 3 ! d 4 ! e 5 ! } } -cleanup { ! foreach element [list a b c d e] { ! if {![nsv_exists fourtwo $element]} { ! error "fourtwo($element) does not exist after 'nsv_array set'" ! } ! } ! } -result "" test ns_nsv-4.3 {nsv_array names} -setup { ! nsv_array set fourthree { ! a 1 ! b 2 ! c 3 ! d 4 ! e 5 ! } } -body { ! lsort [nsv_array names fourthree] ! } -result "a b c d e" ! test ns_nsv-4.4 {nsv_array get} -setup { ! nsv_array set fourfour { ! a 1 ! b 2 ! c 3 ! d 4 ! e 5 ! } } -body { ! lsort [nsv_array get fourfour] ! } -result "1 2 3 4 5 a b c d e" ! test ns_nsv-4.5 {nsv_array size} -setup { ! nsv_array set fourfive { ! a 1 ! b 2 ! c 3 ! d 4 ! e 5 ! } } -body { ! nsv_array size fourfive ! } -result 5 ! test ns_nsv-4.6 {nsv_array names reset} -setup { ! nsv_array set foursix { ! a 1 ! b 2 ! c 3 ! d 4 ! e 5 ! } } -body { ! array set reset { ! A 1 ! B 2 ! C 3 ! D 4 ! E 5 ! } ! nsv_array reset foursix [array get reset] ! lsort [nsv_array get foursix] ! } -result "1 2 3 4 5 A B C D E" ! test ns_nsv-4.7 {nsv_array names reset} -setup { ! nsv_set fourseven foo bar } -body { ! nsv_array exists fourseven ! } -result 1 - test ns_nsv-5.1 {nsv_get arrayname} -body { - nsv_get fiveone - } -returnCodes error -result {wrong # args: should be "nsv_get array key"} ! test ns_nsv-5.2 {nsv_get nonexisting key from nonexisting array} -body { ! nsv_get fivetwo zirrZarr ! } -returnCodes error -result {no such array: fivetwo} ! test ns_nsv-5.3 {nsv_get nonexisting key} -setup { ! nsv_set fivetwo moo . } -body { ! nsv_get fivetwo zirrZarr ! } -returnCodes error -result {no such key: zirrZarr} ! ! test ns_nsv-5.4 {nsv_get existing key} -body { ! nsv_set fivethree foo bar ! nsv_get fivethree foo ! } -result "bar" ! test ns_nsv-6.1 {nsv_exists nonexisting key} -body { ! nsv_exists sixone foo } -result 0 test ns_nsv-6.2 {nsv_exists existing key} -body { ! nsv_set sixtwo foo bar ! nsv_exists sixtwo foo } -result 1 - test ns_nsv-7.1 {nsv_append argument syntax} -body { - nsv_append foo - } -returnCodes error -result {wrong # args: should be "nsv_append array key string ?string ...?"} - - test ns_nsv-7.2 {nsv_append} -setup { - if {[nsv_array exists foo]} { - nsv_unset foo - } - } -body { - nsv_append foo bar baz - nsv_append foo bar baz - nsv_append foo bar baz - } -result "bazbazbaz" - - - - - - test ns_nsv-8.1 {nsv_lappend argument syntax} -body { - nsv_lappend foo - } -returnCodes error -result {wrong # args: should be "nsv_lappend array key string ?string ...?"} - - test ns_nsv-8.2 {nsv_lappend} -setup { - if {[nsv_array exists foo]} { - nsv_unset foo - } - } -body { - nsv_lappend foo bar baz - nsv_lappend foo bar baz - nsv_lappend foo bar baz - } -result "baz baz baz" - test ns_nsv-8.3 {nsv_lappend number of elements} -setup { - if {[nsv_array exists foo]} { - nsv_unset foo - } - } -body { - nsv_lappend foo bar [list a 1] - nsv_lappend foo bar [list b 2] - nsv_lappend foo bar [list c 3] - llength [nsv_get foo bar] - } -result 3 ! test ns_nsv-9.1 {nsv_incr without count} -setup { ! if {[nsv_exists foo bar]} { ! nsv_unset foo bar ! } ! } -body { ! nsv_incr foo bar ! nsv_incr foo bar ! nsv_incr foo bar ! } -result 3 ! test ns_nsv-9.2 {nsv_incr with positive count} -setup { ! if {[nsv_exists foo bar]} { ! nsv_unset foo bar ! } ! } -body { ! nsv_incr foo bar +10 ! nsv_incr foo bar +20 ! nsv_incr foo bar +30 ! } -result 60 ! test ns_nsv-9.3 {nsv_incr with negative count} -setup { ! if {[nsv_exists foo bar]} { ! nsv_unset foo bar ! } ! } -body { ! nsv_incr foo bar -10 ! nsv_incr foo bar -20 ! nsv_incr foo bar -30 ! } -result "-60" ! test ns_nsv-9.4 {nsv_incr with unrepresentable count} -setup { ! if {[nsv_exists foo bar]} { ! nsv_unset foo bar ! } ! } -body { ! nsv_incr foo bar +1000000000000 } -returnCodes error -result {integer value too large to represent} ! test ns_nsv-9.5 {nsv_incr from negative to positive} -setup { ! if {[nsv_exists foo bar]} { ! nsv_unset foo bar ! } ! nsv_set foo bar -60 ! } -body { ! nsv_incr foo bar ! nsv_incr foo bar ! nsv_incr foo bar ! } -result "-57" ! test ns_nsv-9.6 {nsv_incr type mismatch} -setup { ! if {[nsv_exists foo bar]} { ! nsv_unset foo bar ! } ! } -body { ! nsv_incr foo bar a ! } -returnCodes error -result {expected integer but got "a"} ! test ns_nsv-9.7 {nsv_incr by zero} -setup { ! if {[nsv_exists foo bar]} { ! nsv_unset foo bar ! } ! } -body { ! nsv_incr foo bar +000 ! nsv_incr foo bar +00 ! nsv_incr foo bar +0 } -result 0 ! ! test ns_nsv-10.1 {nsv_names} -setup { ! foreach key [list aaa bbb ccc aaaAAA bbbBBB cccCCC] { ! if {[nsv_array exists $key]} { ! nsv_unset $key ! } ! nsv_set $key x y ! } ! } -match regexp -body { ! nsv_names ! } -result "cccCCC|bbbBBB|aaaAAA|ccc|bbb|aaa" ! ! test ns_nsv-10.2 {nsv_names} -setup { ! foreach key [list aaa bbb ccc aaaAAA bbbBBB cccCCC] { ! if {[nsv_array exists $key]} { ! nsv_unset $key ! } ! nsv_set $key x y ! } ! } -body { ! nsv_names ccc ! } -result "ccc" ! ! test ns_nsv-10.3 {nsv_names} -setup { ! foreach key [list aaa bbb ccc aaaAAA bbbBBB cccCCC] { ! if {[nsv_array exists $key]} { ! nsv_unset $key ! } ! nsv_set $key x y ! } ! } -body { ! nsv_names ccc* ! } -result "ccc cccCCC" ! ! --- 48,332 ---- test ns_nsv-2.1 {nsv_set a key} -body { ! nsv_set a k v ! } -cleanup { ! nsv_unset -nocomplain a ! } -result v test ns_nsv-2.2 {nsv_set same key} -body { ! nsv_set a k v1 ! nsv_set a k v2 ! } -cleanup { ! nsv_unset -nocomplain a ! } -result v2 test ns_nsv-2.3 {nsv_set an "integer" key} -body { ! nsv_set a 1 v ! } -cleanup { ! nsv_unset -nocomplain a ! } -result v test ns_nsv-2.4 {nsv_set key with spaces} -body { ! nsv_set a "and now to something different" v ! } -cleanup { ! nsv_unset -nocomplain a ! } -result v test ns_nsv-2.5 {nsv_set big value} -body { ! # 1MB ! nsv_set a k [string repeat "x" [expr {1024*1024}]] ! } -cleanup { ! nsv_unset -nocomplain a } -result [string repeat "x" [expr {1024*1024}]] test ns_nsv-3.1 {nsv_unset too many args} -body { ! nsv_unset a k v x ! } -returnCodes error -result {wrong # args: should be "nsv_unset ?-nocomplain? ?--? array ?key?"} test ns_nsv-3.2 {nsv_unset key} -setup { ! nsv_set a k v } -body { ! nsv_unset a k ! nsv_exists a k ! } -result 0 test ns_nsv-3.3 {nsv_unset an "integer" key} -setup { ! nsv_set a 1 v } -body { ! nsv_unset a 1 ! nsv_exists a 1 ! } -result 0 test ns_nsv-3.4 {nsv_unset key with spaces} -setup { ! nsv_set a "and now to something different" v } -body { ! nsv_unset a "and now to something different" ! nsv_exists a "and now to something different" ! } -result 0 test ns_nsv-3.5 {nsv_unset array} -setup { ! nsv_set a k1 v1 ! nsv_set a k2 v2 ! nsv_set a k3 v3 } -body { ! nsv_unset a ! list [nsv_exists a k1] [nsv_exists a k2] [nsv_exists a k3] ! } -result {0 0 0} ! ! test ns_nsv-3.6 {nsv_unset non-existing array} -body { ! nsv_unset non_existing_array ! } -returnCodes error -result {no such array: non_existing_array} + test ns_nsv-3.7 {nsv_unset non-existing array without complaint} -body { + nsv_unset -nocomplain non_existing_array + } -result {} + test ns_nsv-3.8 {nsv_unset non-existing key} -setup { + nsv_set a k v + } -body { + nsv_unset a missing_key + } -cleanup { + nsv_unset -nocomplain a + } -returnCodes error -result {no such key: missing_key} + test ns_nsv-3.9 {nsv_unset non-existing key without complaint} -setup { + nsv_set a k v + } -body { + nsv_unset -nocomplain a k + } -cleanup { + nsv_unset a + } -result {} ! test ns_nsv-4.1 {nsv_array set} -body { ! nsv_array set a {k1 v1 k2 v2} ! list [nsv_exists a k1] [nsv_exists a k2] } -cleanup { ! nsv_unset -nocomplain a ! } -result {1 1} test ns_nsv-4.3 {nsv_array names} -setup { ! nsv_array set a {k1 v1 k2 v2} } -body { ! lsort [nsv_array names a] ! } -cleanup { ! nsv_unset -nocomplain a ! } -result {k1 k2} ! test ns_nsv-4.4 {nsv_array names glob} -setup { ! nsv_array set a {k1 v1 K2 V2} } -body { ! nsv_array names a k* ! } -cleanup { ! nsv_unset -nocomplain a ! } -result k1 ! test ns_nsv-4.5 {nsv_array get} -setup { ! nsv_array set a {k1 v1 k2 v2} } -body { ! lsort [nsv_array get a] ! } -cleanup { ! nsv_unset -nocomplain a ! } -result {k1 k2 v1 v2} ! test ns_nsv-4.6 {nsv_array get glob} -setup { ! nsv_array set a {k1 v1 K2 V2} } -body { ! lsort [nsv_array get a k*] ! } -cleanup { ! nsv_unset -nocomplain a ! } -result {k1 v1} ! test ns_nsv-4.7 {nsv_array size} -setup { ! nsv_array set a {k1 v1 k2 v2} } -body { ! nsv_array size a ! } -cleanup { ! nsv_unset -nocomplain a ! } -result 2 + test ns_nsv-4.8 {nsv_array names reset} -setup { + nsv_array set a {k1 v1 k2 v2} + } -body { + nsv_array reset a {k3 v3 k4 v4} + lsort [nsv_array get a] + } -cleanup { + nsv_unset -nocomplain a + } -result {k3 k4 v3 v4} + test ns_nsv-4.9 {nsv_array exists} -setup { + nsv_set a k v + } -body { + nsv_array exists a + } -cleanup { + nsv_unset -nocomplain a + } -result 1 + test ns_nsv-4.10 {nsv_array exists} -setup { + nsv_array exists noexists + } -result 0 ! test ns_nsv-5.1 {nsv_get nonexisting key from nonexisting array} -body { ! nsv_get noexist noexist ! } -returnCodes error -result {no such array: noexist} ! test ns_nsv-5.2 {nsv_get nonexisting key} -setup { ! nsv_set a k1 v1 } -body { ! nsv_get a k2 ! } -cleanup { ! nsv_unset -nocomplain a ! } -returnCodes error -result {no such key: k2} + test ns_nsv-5.3 {nsv_get existing key} -body { + nsv_set a k v + nsv_get a k + } -cleanup { + nsv_unset -nocomplain a + } -result v test ns_nsv-6.1 {nsv_exists nonexisting key} -body { ! nsv_set a k1 v1 ! nsv_exists a k2 ! } -cleanup { ! nsv_unset -nocomplain a } -result 0 test ns_nsv-6.2 {nsv_exists existing key} -body { ! nsv_set a k v ! nsv_exists a k ! } -cleanup { ! nsv_unset -nocomplain a } -result 1 + test ns_nsv-6.3 {nsv_exists nonexisting array} -body { + nsv_exists noexist k + } -result 0 + test ns_nsv-7.1 {nsv_append} -body { + nsv_append a k v + nsv_append a k v + } -cleanup { + nsv_unset -nocomplain a + } -result vv + test ns_nsv-8.1 {nsv_lappend} -body { + nsv_lappend a k v + nsv_lappend a k v + } -cleanup { + nsv_unset -nocomplain a + } -result {v v} + test ns_nsv-8.3 {nsv_lappend number of elements} -body { + nsv_lappend a k [list v1 v1] + nsv_lappend a k [list v2 v2] + llength [nsv_get a k] + } -cleanup { + nsv_unset -nocomplain a + } -result 2 ! test ns_nsv-9.1 {nsv_incr without count} -body { ! nsv_incr a k ! nsv_incr a k ! } -cleanup { ! nsv_unset -nocomplain a ! } -result 2 ! test ns_nsv-9.2 {nsv_incr with positive count} -body { ! nsv_incr a k +10 ! nsv_incr a k +20 ! } -cleanup { ! nsv_unset -nocomplain a ! } -result 30 ! test ns_nsv-9.3 {nsv_incr with negative count} -body { ! nsv_incr a k -10 ! nsv_incr a k -20 ! } -cleanup { ! nsv_unset -nocomplain a ! } -result -30 ! test ns_nsv-9.4 {nsv_incr with unrepresentable count} -body { ! nsv_incr a k +1000000000000 } -returnCodes error -result {integer value too large to represent} ! test ns_nsv-9.5 {nsv_incr from negative to positive} -body { ! nsv_set a k -1 ! nsv_incr a k ! nsv_incr a k ! } -cleanup { ! nsv_unset -nocomplain a ! } -result 1 ! test ns_nsv-9.6 {nsv_incr type mismatch} -body { ! nsv_incr a k v ! } -returnCodes error -result {expected integer but got "v"} ! test ns_nsv-9.7 {nsv_incr by zero} -body { ! nsv_incr a k +0 ! nsv_incr a k +00 ! } -cleanup { ! nsv_unset -nocomplain a } -result 0 ! test ns_nsv-10.1 {nsv_names} -body { ! nsv_set nsv-a1 k v ! nsv_set nsv-a2 k v ! lsort [nsv_names nsv-a*] ! } -result {nsv-a1 nsv-a2} |
From: Stephen D. <sd...@us...> - 2005-12-11 10:01:23
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19572/nsd Modified Files: tclvar.c Log Message: * nsd/tclvar.c: * tests/ns_nsv.test: Add -nocomplain switch to nsv_unset command to match Tcl unset command. Index: tclvar.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclvar.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tclvar.c 11 Dec 2005 08:20:08 -0000 1.4 --- tclvar.c 11 Dec 2005 10:01:10 -0000 1.5 *************** *** 504,521 **** { Array *arrayPtr = NULL; Tcl_HashEntry *hPtr = NULL; ! if (objc != 2 && objc != 3) { ! Tcl_WrongNumArgs(interp, 1, objv, "array ?key?"); return TCL_ERROR; } ! arrayPtr = LockArray(arg, interp, objv[1], 0); if (arrayPtr == NULL) { return TCL_ERROR; } ! if (objc == 2) { Tcl_DeleteHashEntry(arrayPtr->entryPtr); } else { ! hPtr = Tcl_FindHashEntry(&arrayPtr->vars, Tcl_GetString(objv[2])); if (hPtr != NULL) { ns_free(Tcl_GetHashValue(hPtr)); --- 504,538 ---- { Array *arrayPtr = NULL; + Tcl_Obj *arrayObj; Tcl_HashEntry *hPtr = NULL; + char *key = NULL; + int nocomplain = 0; ! Ns_ObjvSpec opts[] = { ! {"-nocomplain", Ns_ObjvBool, &nocomplain, (void *) NS_TRUE}, ! {"--", Ns_ObjvBreak, NULL, NULL}, ! {NULL, NULL, NULL, NULL} ! }; ! Ns_ObjvSpec args[] = { ! {"array", Ns_ObjvObj, &arrayObj, NULL}, ! {"?key", Ns_ObjvString, &key, NULL}, ! {NULL, NULL, NULL, NULL} ! }; ! if (Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) { return TCL_ERROR; } ! ! arrayPtr = LockArray(arg, interp, arrayObj, 0); if (arrayPtr == NULL) { + if (nocomplain) { + Tcl_ResetResult(interp); + return TCL_OK; + } return TCL_ERROR; } ! if (key == NULL) { Tcl_DeleteHashEntry(arrayPtr->entryPtr); } else { ! hPtr = Tcl_FindHashEntry(&arrayPtr->vars, key); if (hPtr != NULL) { ns_free(Tcl_GetHashValue(hPtr)); *************** *** 524,532 **** } UnlockArray(arrayPtr); ! if (objc == 2) { FlushArray(arrayPtr); Tcl_DeleteHashTable(&arrayPtr->vars); ns_free(arrayPtr); ! } else if (hPtr == NULL) { Tcl_AppendResult(interp, "no such key: ", Tcl_GetString(objv[2]), NULL); return TCL_ERROR; --- 541,549 ---- } UnlockArray(arrayPtr); ! if (key == NULL) { FlushArray(arrayPtr); Tcl_DeleteHashTable(&arrayPtr->vars); ns_free(arrayPtr); ! } else if (hPtr == NULL && !nocomplain) { Tcl_AppendResult(interp, "no such key: ", Tcl_GetString(objv[2]), NULL); return TCL_ERROR; |
From: Stephen D. <sd...@us...> - 2005-12-11 10:01:23
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19572 Modified Files: ChangeLog Log Message: * nsd/tclvar.c: * tests/ns_nsv.test: Add -nocomplain switch to nsv_unset command to match Tcl unset command. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.256 retrieving revision 1.257 diff -C2 -d -r1.256 -r1.257 *** ChangeLog 11 Dec 2005 08:20:08 -0000 1.256 --- ChangeLog 11 Dec 2005 10:01:10 -0000 1.257 *************** *** 3,6 **** --- 3,10 ---- * nsd/tclvar.c: Untabify and reformat. + * nsd/tclvar.c: + * tests/ns_nsv.test: Add -nocomplain switch to nsv_unset command + to match Tcl unset command. + 2005-12-10 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-12-11 08:20:18
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4575 Modified Files: ChangeLog Log Message: Untabify and reformat. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.255 retrieving revision 1.256 diff -C2 -d -r1.255 -r1.256 *** ChangeLog 11 Dec 2005 04:44:04 -0000 1.255 --- ChangeLog 11 Dec 2005 08:20:08 -0000 1.256 *************** *** 1,2 **** --- 1,6 ---- + 2005-12-11 Stephen Deasey <sd...@us...> + + * nsd/tclvar.c: Untabify and reformat. + 2005-12-10 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-12-11 08:20:16
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4575/nsd Modified Files: tclvar.c Log Message: Untabify and reformat. Index: tclvar.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclvar.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tclvar.c 12 Jun 2005 14:42:44 -0000 1.3 --- tclvar.c 11 Dec 2005 08:20:08 -0000 1.4 *************** *** 31,35 **** * tclvar.c -- * ! * Support for the old ns_var and new nsv_* commands. */ --- 31,35 ---- * tclvar.c -- * ! * Support for the old ns_var and new nsv_* commands. */ [...1343 lines suppressed...] case VListIdx: *************** *** 840,846 **** hPtr = Tcl_NextHashEntry(&search); } ! break; } Ns_MutexUnlock(&servPtr->var.lock); return code; } --- 853,860 ---- hPtr = Tcl_NextHashEntry(&search); } ! break; } Ns_MutexUnlock(&servPtr->var.lock); + return code; } |
From: Stephen D. <sd...@us...> - 2005-12-11 04:44:14
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4761/nsd Modified Files: fastpath.c nsd.h proc.c server.c tclcmds.c tclrequest.c Log Message: * include/ns.h: * nsd/nsd.h: * nsd/fastpath.c: * nsd/tclrequest.c: * nsd/tclcmds.c: * nsd/server.c: * nsd/proc.c: * tests/ns_register_proc.test: Add new Tcl command ns_register_fastpath which re-register the original fastpath proc for static file serving, for the specified method and URL. This allows e.g. a Tcl proc to be registered as the default handler for the URL / and then override this with the fastpath proc for /images. The fastpath proc invokes no Tcl and therefore does not allocate an interp. Non-Tcl using threads can be segregated using the conn pool mechanism. (RFE: http://sf.net/tracker/index.php?func=detail&aid=1012770&group_id=3152&atid=353152) Index: fastpath.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/fastpath.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** fastpath.c 7 Nov 2005 03:17:55 -0000 1.25 --- fastpath.c 11 Dec 2005 04:44:05 -0000 1.26 *************** *** 245,293 **** /* *---------------------------------------------------------------------- ! * FastGetRestart -- * ! * Construct the full URL and redirect internally. * * Results: ! * See Ns_ConnRedirect(). * * Side effects: ! * See Ns_ConnRedirect(). * *---------------------------------------------------------------------- */ ! static int ! FastGetRestart(Ns_Conn *conn, CONST char *page) { ! int status; ! Ns_DString ds; ! ! Ns_DStringInit(&ds); ! Ns_MakePath(&ds, conn->request->url, page, NULL); ! status = Ns_ConnRedirect(conn, ds.string); ! Ns_DStringFree(&ds); ! return status; } - - /* - *---------------------------------------------------------------------- - * NsFastGet -- - * - * Return the contents of a URL. - * - * Results: - * Return NS_OK for success or NS_ERROR for failure. - * - * Side effects: - * Contents of file may be cached in file cache. - * - *---------------------------------------------------------------------- - */ - int ! NsFastGet(void *arg, Ns_Conn *conn) { Ns_DString ds; --- 245,275 ---- /* *---------------------------------------------------------------------- ! * Ns_FastPathProc, NsFastPathProc -- * ! * Return the contents of a URL. * * Results: ! * Return NS_OK for success or NS_ERROR for failure. * * Side effects: ! * Contents of file may be cached in file cache. * *---------------------------------------------------------------------- */ ! int ! Ns_FastPathProc(void *arg, Ns_Conn *conn) { ! char *server = arg; ! NsServer *servPtr; ! if ((servPtr = NsGetServer(server)) == NULL) { ! return NS_ERROR; ! } ! return NsFastPathProc(servPtr, conn); } int ! NsFastPathProc(void *arg, Ns_Conn *conn) { Ns_DString ds; *************** *** 365,368 **** --- 347,380 ---- /* *---------------------------------------------------------------------- + * FastGetRestart -- + * + * Construct the full URL and redirect internally. + * + * Results: + * See Ns_ConnRedirect(). + * + * Side effects: + * See Ns_ConnRedirect(). + * + *---------------------------------------------------------------------- + */ + + static int + FastGetRestart(Ns_Conn *conn, CONST char *page) + { + int status; + Ns_DString ds; + + Ns_DStringInit(&ds); + Ns_MakePath(&ds, conn->request->url, page, NULL); + status = Ns_ConnRedirect(conn, ds.string); + Ns_DStringFree(&ds); + + return status; + } + + + /* + *---------------------------------------------------------------------- * FreeEntry -- * Index: tclcmds.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclcmds.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tclcmds.c 7 Nov 2005 03:17:55 -0000 1.25 --- tclcmds.c 11 Dec 2005 04:44:05 -0000 1.26 *************** *** 126,129 **** --- 126,130 ---- NsTclRandObjCmd, NsTclRegisterAdpObjCmd, + NsTclRegisterFastPathObjCmd, NsTclRegisterFastUrl2FileObjCmd, NsTclRegisterFilterObjCmd, *************** *** 388,391 **** --- 389,393 ---- {"ns_register_adp", NULL, NsTclRegisterAdpObjCmd}, {"ns_register_adptag", NsTclRegisterTagCmd, NULL}, + {"ns_register_fastpath", NULL, NsTclRegisterFastPathObjCmd}, {"ns_register_fasturl2file", NULL, NsTclRegisterFastUrl2FileObjCmd}, {"ns_register_filter", NULL, NsTclRegisterFilterObjCmd}, Index: server.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/server.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** server.c 7 Nov 2005 03:17:55 -0000 1.14 --- server.c 11 Dec 2005 04:44:05 -0000 1.15 *************** *** 415,421 **** */ ! Ns_RegisterRequest(server, "GET", "/", NsFastGet, NULL, servPtr, 0); ! Ns_RegisterRequest(server, "HEAD", "/", NsFastGet, NULL, servPtr, 0); ! Ns_RegisterRequest(server, "POST", "/", NsFastGet, NULL, servPtr, 0); /* --- 415,421 ---- */ ! Ns_RegisterRequest(server, "GET", "/", NsFastPathProc, NULL, servPtr, 0); ! Ns_RegisterRequest(server, "HEAD", "/", NsFastPathProc, NULL, servPtr, 0); ! Ns_RegisterRequest(server, "POST", "/", NsFastPathProc, NULL, servPtr, 0); /* Index: nsd.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsd.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** nsd.h 24 Nov 2005 19:01:20 -0000 1.39 --- nsd.h 11 Dec 2005 04:44:05 -0000 1.40 *************** *** 880,884 **** extern Ns_ArgProc NsConnArgProc; extern Ns_FilterProc NsTclFilterProc; ! extern Ns_OpProc NsFastGet; extern Ns_OpProc NsTclRequestProc; extern Ns_OpProc NsAdpRequestProc; --- 880,884 ---- extern Ns_ArgProc NsConnArgProc; extern Ns_FilterProc NsTclFilterProc; ! extern Ns_OpProc NsFastPathProc; extern Ns_OpProc NsTclRequestProc; extern Ns_OpProc NsAdpRequestProc; Index: proc.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/proc.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** proc.c 7 Nov 2005 03:17:55 -0000 1.9 --- proc.c 11 Dec 2005 04:44:05 -0000 1.10 *************** *** 80,84 **** {(void *) NsAdpRequestProc, "ns:adprequest", ServerArgProc}, {(void *) NsAdpMapProc, "ns:adpmap", Ns_StringArgProc}, ! {(void *) NsFastGet, "ns:fastget", ServerArgProc}, {(void *) NsTclTraceProc, "ns:tcltrace", Ns_TclCallbackArgProc}, {(void *) NsTclUrl2FileProc, "ns:tclurl2file", Ns_TclCallbackArgProc}, --- 80,84 ---- {(void *) NsAdpRequestProc, "ns:adprequest", ServerArgProc}, {(void *) NsAdpMapProc, "ns:adpmap", Ns_StringArgProc}, ! {(void *) NsFastPathProc, "ns:fastget", ServerArgProc}, {(void *) NsTclTraceProc, "ns:tcltrace", Ns_TclCallbackArgProc}, {(void *) NsTclUrl2FileProc, "ns:tclurl2file", Ns_TclCallbackArgProc}, Index: tclrequest.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclrequest.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tclrequest.c 5 Dec 2005 08:40:23 -0000 1.7 --- tclrequest.c 11 Dec 2005 04:44:05 -0000 1.8 *************** *** 134,137 **** --- 134,182 ---- *---------------------------------------------------------------------- * + * NsTclRegisterFastPathObjCmd -- + * + * Implements ns_register_fastpath as obj command. + * + * Results: + * Tcl result. + * + * Side effects: + * See docs. + * + *---------------------------------------------------------------------- + */ + + int + NsTclRegisterFastPathObjCmd(ClientData arg, Tcl_Interp *interp, int objc, + Tcl_Obj *CONST objv[], int adp) + { + NsInterp *itPtr = arg; + char *method, *url; + int flags = 0; + + Ns_ObjvSpec opts[] = { + {"-noinherit", Ns_ObjvBool, &flags, (void *) NS_OP_NOINHERIT}, + {"--", Ns_ObjvBreak, NULL, NULL}, + {NULL, NULL, NULL, NULL} + }; + Ns_ObjvSpec args[] = { + {"method", Ns_ObjvString, &method, NULL}, + {"url", Ns_ObjvString, &url, NULL}, + {NULL, NULL, NULL, NULL} + }; + if (Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) { + return TCL_ERROR; + } + + Ns_RegisterRequest(itPtr->servPtr->server, method, url, + NsFastPathProc, NULL, itPtr->servPtr, flags); + + return TCL_OK; + } + + + /* + *---------------------------------------------------------------------- + * * NsTclRegisterAdpObjCmd -- * |
From: Stephen D. <sd...@us...> - 2005-12-11 04:44:13
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4761 Modified Files: ChangeLog Log Message: * include/ns.h: * nsd/nsd.h: * nsd/fastpath.c: * nsd/tclrequest.c: * nsd/tclcmds.c: * nsd/server.c: * nsd/proc.c: * tests/ns_register_proc.test: Add new Tcl command ns_register_fastpath which re-register the original fastpath proc for static file serving, for the specified method and URL. This allows e.g. a Tcl proc to be registered as the default handler for the URL / and then override this with the fastpath proc for /images. The fastpath proc invokes no Tcl and therefore does not allocate an interp. Non-Tcl using threads can be segregated using the conn pool mechanism. (RFE: http://sf.net/tracker/index.php?func=detail&aid=1012770&group_id=3152&atid=353152) Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.254 retrieving revision 1.255 diff -C2 -d -r1.254 -r1.255 *** ChangeLog 11 Dec 2005 03:33:30 -0000 1.254 --- ChangeLog 11 Dec 2005 04:44:04 -0000 1.255 *************** *** 9,12 **** --- 9,29 ---- locale is in effect. (Bug# 1340755) + * include/ns.h: + * nsd/nsd.h: + * nsd/fastpath.c: + * nsd/tclrequest.c: + * nsd/tclcmds.c: + * nsd/server.c: + * nsd/proc.c: + * tests/ns_register_proc.test: Add new Tcl command ns_register_fastpath + which re-register the original fastpath proc for static file serving, + for the specified method and URL. This allows e.g. a Tcl proc to + be registered as the default handler for the URL / and then + override this with the fastpath proc for /images. The fastpath + proc invokes no Tcl and therefore does not allocate an interp. + Non-Tcl using threads can be segregated using the conn pool + mechanism. + (RFE: http://sf.net/tracker/index.php?func=detail&aid=1012770&group_id=3152&atid=353152) + 2005-12-05 Stephen Deasey <sd...@gr...> |
From: Stephen D. <sd...@us...> - 2005-12-11 04:44:13
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4761/include Modified Files: ns.h Log Message: * include/ns.h: * nsd/nsd.h: * nsd/fastpath.c: * nsd/tclrequest.c: * nsd/tclcmds.c: * nsd/server.c: * nsd/proc.c: * tests/ns_register_proc.test: Add new Tcl command ns_register_fastpath which re-register the original fastpath proc for static file serving, for the specified method and URL. This allows e.g. a Tcl proc to be registered as the default handler for the URL / and then override this with the fastpath proc for /images. The fastpath proc invokes no Tcl and therefore does not allocate an interp. Non-Tcl using threads can be segregated using the conn pool mechanism. (RFE: http://sf.net/tracker/index.php?func=detail&aid=1012770&group_id=3152&atid=353152) Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** ns.h 5 Dec 2005 08:40:23 -0000 1.62 --- ns.h 11 Dec 2005 04:44:04 -0000 1.63 *************** *** 919,922 **** --- 919,924 ---- Ns_UrlIsDir(CONST char *server, CONST char *url); + NS_EXTERN Ns_OpProc Ns_FastPathProc; + /* * filter.c: |
From: Stephen D. <sd...@us...> - 2005-12-11 04:44:12
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4761/tests Modified Files: ns_register_proc.test Log Message: * include/ns.h: * nsd/nsd.h: * nsd/fastpath.c: * nsd/tclrequest.c: * nsd/tclcmds.c: * nsd/server.c: * nsd/proc.c: * tests/ns_register_proc.test: Add new Tcl command ns_register_fastpath which re-register the original fastpath proc for static file serving, for the specified method and URL. This allows e.g. a Tcl proc to be registered as the default handler for the URL / and then override this with the fastpath proc for /images. The fastpath proc invokes no Tcl and therefore does not allocate an interp. Non-Tcl using threads can be segregated using the conn pool mechanism. (RFE: http://sf.net/tracker/index.php?func=detail&aid=1012770&group_id=3152&atid=353152) Index: ns_register_proc.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_register_proc.test,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ns_register_proc.test 5 Dec 2005 08:40:23 -0000 1.1 --- ns_register_proc.test 11 Dec 2005 04:44:05 -0000 1.2 *************** *** 19,22 **** --- 19,26 ---- } -returnCodes error -result {wrong # args: should be "ns_unregister_proc ?-noinherit? ?-recurse? ?--? method url"} + test proc-1.3 {basic syntax} -body { + ns_register_fastpath + } -returnCodes error -result {wrong # args: should be "ns_register_fastpath ?-noinherit? ?--? method url"} + *************** *** 102,104 **** --- 106,119 ---- + test proc-5.1 {fastpath} -setup { + ns_register_proc GET /10bytes {ns_return 200 text/plain error ;#} + ns_register_fastpath GET /10bytes + } -body { + nstest_http -getbody 1 GET /10bytes + } -cleanup { + ns_unregister_proc GET /10bytes + } -result {200 0123456789} + + + cleanupTests |
From: Stephen D. <sd...@us...> - 2005-12-11 03:33:40
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25667/nsd Modified Files: httptime.c Log Message: * nsd/httptime.c: * tests/hs_httptime.test: Use snprintf to format the date to ensure the English week and month names are always used, no matter which locale is in effect. (Bug# 1340755) Index: httptime.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/httptime.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** httptime.c 11 Dec 2005 03:17:26 -0000 1.4 --- httptime.c 11 Dec 2005 03:33:30 -0000 1.5 *************** *** 56,59 **** --- 56,63 ---- }; + static CONST char *week_names[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + #ifdef HAVE_TIMEGM static Ns_Mutex lock; *************** *** 96,104 **** /* ! * 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); --- 100,112 ---- /* ! * The format is RFC 1123 "Sun, 06 Nov 1997 09:12:45 GMT" ! * and is locale independant, so English week and month names ! * must always be used. */ ! snprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", ! week_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: Stephen D. <sd...@us...> - 2005-12-11 03:33:39
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25667 Modified Files: ChangeLog Log Message: * nsd/httptime.c: * tests/hs_httptime.test: Use snprintf to format the date to ensure the English week and month names are always used, no matter which locale is in effect. (Bug# 1340755) Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.253 retrieving revision 1.254 diff -C2 -d -r1.253 -r1.254 *** ChangeLog 11 Dec 2005 03:17:25 -0000 1.253 --- ChangeLog 11 Dec 2005 03:33:30 -0000 1.254 *************** *** 4,7 **** --- 4,12 ---- * tests/ns_httptime.test: Add tests for ns_parsehttptime. + * nsd/httptime.c: + * tests/hs_httptime.test: Use snprintf to format the date to ensure the + English week and month names are always used, no matter which + locale is in effect. (Bug# 1340755) + 2005-12-05 Stephen Deasey <sd...@gr...> |