This is an automated email from the ASF dual-hosted git repository. mxmanghi pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git
commit ca1929925b775496373dfec86f53af6342a98009 Author: Massimo Manghi <mxman...@apache.org> AuthorDate: Wed Jun 14 17:21:25 2023 +0200 various minor changes, a test improvement for channel.test, output mechanism generalization for ::rivet::parray --- ChangeLog | 7 ++++++ rivet/init.tcl.in | 4 +-- rivet/packages/session/session-class.tcl | 9 +++---- rivet/rivet-tcl/parray.tcl | 14 +++++------ src/mod_rivet_ng/mod_rivet.c | 17 +++++-------- src/mod_rivet_ng/mod_rivet_generator.c | 3 --- tests/channel.test | 43 ++++++++++++++++---------------- 7 files changed, 46 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index c195c41..063b7c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-06-14 Massimo Manghi <mxman...@apache.org> + * tests/channel.test: indenting code for improved readability + * src/mod_rivet_ng/mod_rivet.c,mod_rivet_generator.c: Removed unused code that + ha been commented out long ago + * rivet/rivet-tcl/parray.tcl: ::rivet::parray now accepting alternative way to + return output. + 2023-05-14 Massimo Manghi <mxman...@apache.org> * tests/rivet.test: more contributions provided by Scott Pitcher <sco...@svptechnicalservices.com.au>) * tests/apachetest/apachetest.tcl: More improvements to the test script. Now diff --git a/rivet/init.tcl.in b/rivet/init.tcl.in index 9ab96b9..e260953 100644 --- a/rivet/init.tcl.in +++ b/rivet/init.tcl.in @@ -235,8 +235,8 @@ proc ::Rivet::tcl_commands_export_list {tclpath} { variable auto_index array set auto_index {} - # the auto_index in ${tclpath}/tclIndex is loaded - # this array is used to fetch a list of Rivet commands + # The auto_index in ${tclpath}/tclIndex is loaded. + # This array is used to fetch a list of Rivet commands # implemented in Rivet set dir $tclpath diff --git a/rivet/packages/session/session-class.tcl b/rivet/packages/session/session-class.tcl index 28fb3e1..1ce51f4 100644 --- a/rivet/packages/session/session-class.tcl +++ b/rivet/packages/session/session-class.tcl @@ -346,21 +346,18 @@ package require Itcl } # - # stash - + # stash - given a packagename and a key-value dictionary of data + # the procedure calls method store to data into the cache table using + # the dictionary keys as column _key value # # method stash {packageName keyvalue_d} { - dict for {key value} $keyvalue_d { - $this store $packageName $key $value - } - } - # # load - given a package names returns a dictionary storing the key - value pairs for this session # diff --git a/rivet/rivet-tcl/parray.tcl b/rivet/rivet-tcl/parray.tcl index 784b01e..b9f2582 100644 --- a/rivet/rivet-tcl/parray.tcl +++ b/rivet/rivet-tcl/parray.tcl @@ -7,13 +7,11 @@ ## arrayName - Name of the array to display. ## pattern - A wildcard pattern of variables within the array to display. ## -## $Id$ -## ### namespace eval ::rivet { - proc parray {arrayName {pattern *}} { + proc parray {arrayName {pattern *} {outputcmd "puts stdout"}} { upvar 1 $arrayName array if {![array exists array]} { return -code error "\"$arrayName\" isn't an array" @@ -24,14 +22,14 @@ namespace eval ::rivet { set maxl [string length $name] } } - puts stdout "<PRE><B>$arrayName</B>" + set html_text [list "<b>$arrayName</b>"] set maxl [expr {$maxl + [string length $arrayName] + 2}] foreach name [lsort [array names array $pattern]] { - set nameString [format %s(%s) $arrayName [::rivet::escape_sgml_chars $name]] - puts stdout [format "%-*s = %s" $maxl $nameString [::rivet::escape_sgml_chars $array($name)]] + set nameString [format "%s(%s)" $arrayName [::rivet::escape_sgml_chars $name]] + lappend html_text [format "%-*s = %s" $maxl $nameString [::rivet::escape_sgml_chars $array($name)]] } - puts stdout "</PRE>" + + eval $outputcmd [list <pre>[join $html_text "\n"]</pre>] } - namespace export parray } diff --git a/src/mod_rivet_ng/mod_rivet.c b/src/mod_rivet_ng/mod_rivet.c index 7b583ba..19b5dc4 100644 --- a/src/mod_rivet_ng/mod_rivet.c +++ b/src/mod_rivet_ng/mod_rivet.c @@ -319,6 +319,9 @@ Rivet_RunServerInit (apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp, ser * Post config hook. The server initialization loads the MPM bridge * and runs the Tcl server initialization script * + * The module globals structure is allocated and initialized by + * the pre-config hook procedure (Rivet_InitGlobals) + * */ static int @@ -334,10 +337,8 @@ Rivet_ServerInit (apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp, server ap_add_version_component(pPool,RIVET_PACKAGE_NAME); #endif - /* This function runs as post_config_hook - * and as such it's run twice by design. - * This is the recommended way to avoid a double load of - * external modules. + /* This function runs as post_config_hook and as such it's run twice by design. + * This is the recommended way to avoid a double load of external modules. */ apr_pool_userdata_get(&userdata, userdata_key, server->process->pool); @@ -352,13 +353,7 @@ Rivet_ServerInit (apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp, server return OK; /* This would be the first time through */ } - /* Everything revolves around this structure: module_globals */ - - /* the module global structure is allocated and the MPM bridge name established */ - - // module_globals = Rivet_CreateModuleGlobals (pPool,server); - - /* We can proceed initializing the globals with information stored in the module configuration */ + /* We determine the Rivet Bridge and we store its pointer in the module globals */ module_globals->rivet_mpm_bridge = Rivet_SeekMPMBridge(pPool); module_globals->server = server; diff --git a/src/mod_rivet_ng/mod_rivet_generator.c b/src/mod_rivet_ng/mod_rivet_generator.c index 9025c90..1b2627e 100644 --- a/src/mod_rivet_ng/mod_rivet_generator.c +++ b/src/mod_rivet_ng/mod_rivet_generator.c @@ -342,9 +342,6 @@ sendcleanup: ap_log_rerror(APLOG_MARK,APLOG_DEBUG,APR_SUCCESS,private->r, "process terminating with code %d",private->exit_status); RIVET_MPM_BRIDGE_CALL(exit_handler,private); - - //Tcl_Exit(private->exit_status); - //exit(private->exit_status); } /* We now reset the status to prepare the child process for another request */ diff --git a/tests/channel.test b/tests/channel.test index e2f6454..0c2967b 100644 --- a/tests/channel.test +++ b/tests/channel.test @@ -2,27 +2,28 @@ foreach {sep_channel offset_value} {On 0 Off 1} { -::tcltest::test channel-1.1 [list checking SeparateChannel] { - apachetest::start {} " -RivetServerConf SeparateVirtualInterps On -RivetServerConf SeparateChannels $sep_channel -#NameVirtualHost 127.0.0.1 -<VirtualHost *> - ServerName vhost1 - RivetServerConf ChildInitScript \"fconfigure stdout -buffersize 8192\" -</VirtualHost> + ::tcltest::test channel-1.1 [list checking SeparateChannel] { + apachetest::start {} " + RivetServerConf SeparateVirtualInterps On + RivetServerConf SeparateChannels $sep_channel + #NameVirtualHost 127.0.0.1 + <VirtualHost *> + ServerName vhost1 + RivetServerConf ChildInitScript \"fconfigure stdout -buffersize 8192\" + </VirtualHost> -<VirtualHost *> - ServerName vhost2 - RivetServerConf ChildInitScript \"fconfigure stdout -buffersize 16384\" -</VirtualHost> -" { - set page1 [::http::geturl "${urlbase}channel.tcl" -headers [list Host vhost1]] - set page2 [::http::geturl "${urlbase}channel.tcl" -headers [list Host vhost2]] + <VirtualHost *> + ServerName vhost2 + RivetServerConf ChildInitScript \"fconfigure stdout -buffersize 16384\" + </VirtualHost> + " { + set page1 [::http::geturl "${urlbase}channel.tcl" -headers [list Host vhost1]] + set page2 [::http::geturl "${urlbase}channel.tcl" -headers [list Host vhost2]] + + puts "[::http::data $page1] [::http::data $page2]" + set diff [expr ([::http::data $page2]-[::http::data $page1] != 0) + $offset_value] + } + set diff + } {1} - puts "[::http::data $page1] [::http::data $page2]" - set diff [expr ([::http::data $page2]-[::http::data $page1] != 0) + $offset_value] -} -set diff -} {1} } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@tcl.apache.org For additional commands, e-mail: commits-h...@tcl.apache.org