You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2015/11/25 11:05:50 UTC
svn commit: r1716344 - in /tcl/rivet/branches/2.2: ./ doc/xml/ rivet/
rivet/rivet-tcl/ src/ src/apache-2/ src/librivet/ src/rivetcmds/ tests/
Author: mxmanghi
Date: Wed Nov 25 10:05:50 2015
New Revision: 1716344
URL: http://svn.apache.org/viewvc?rev=1716344&view=rev
Log:
* src/rivet.h: add macro RIVET_EXPORT_COMMAND (wraps Tcl_Export)
* src/librivet/rivet[WWW|List|Crypt].c: proper way to put these commands
on the export list
* src/rivetcmds/rivetCore.c: Commands are now put explicitly on the
export list (if build with --enable-rivet-commands-export)
* rivet/init.tcl: removed -force switch when importing the ::rivet command
set. Rationalization of Tcl commands export list
* doc/xml/command.xml: add manual page for ::rivet::exit
* tests/bailout.test: add test for bailout commands ::rivet::abort_page
and ::rivet::exit
* configure.ac: add INIT_VERSION symbol substitution
Modified:
tcl/rivet/branches/2.2/ChangeLog
tcl/rivet/branches/2.2/Makefile.in
tcl/rivet/branches/2.2/configure.ac
tcl/rivet/branches/2.2/doc/xml/commands.xml
tcl/rivet/branches/2.2/rivet/init.tcl
tcl/rivet/branches/2.2/rivet/init.tcl.in
tcl/rivet/branches/2.2/rivet/rivet-tcl/catch.tcl
tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c
tcl/rivet/branches/2.2/src/librivet/rivetCrypt.c
tcl/rivet/branches/2.2/src/librivet/rivetList.c
tcl/rivet/branches/2.2/src/librivet/rivetPkgInit.c
tcl/rivet/branches/2.2/src/librivet/rivetWWW.c
tcl/rivet/branches/2.2/src/rivet.h
tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c
tcl/rivet/branches/2.2/tests/bailout.test
tcl/rivet/branches/2.2/tests/rivet.test
Modified: tcl/rivet/branches/2.2/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/ChangeLog?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/ChangeLog (original)
+++ tcl/rivet/branches/2.2/ChangeLog Wed Nov 25 10:05:50 2015
@@ -1,3 +1,16 @@
+2015-11-25 Massimo Manghi <mx...@apache.org>
+ * src/rivet.h: add macro RIVET_EXPORT_COMMAND (wraps Tcl_Export)
+ * src/librivet/rivet[WWW|List|Crypt].c: proper way to put these commands
+ on the export list
+ * src/rivetcmds/rivetCore.c: Commands are now put explicitly on the
+ export list (if build with --enable-rivet-commands-export)
+ * rivet/init.tcl: removed -force switch when importing the ::rivet command
+ set. Rationalization of Tcl commands export list
+ * doc/xml/command.xml: add manual page for ::rivet::exit
+ * tests/bailout.test: add test for bailout commands ::rivet::abort_page
+ and ::rivet::exit
+ * configure.ac: add INIT_VERSION symbol substitution
+
2015-11-21 Massimo Manghi <mx...@apache.org>
* src/rivetcmds/rivetCore.c: return EXITPAGECODE when ::rivet::exit
is called.Add [::rivet::abort_page -exiting] exit condition detection
Modified: tcl/rivet/branches/2.2/Makefile.in
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/Makefile.in?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/Makefile.in (original)
+++ tcl/rivet/branches/2.2/Makefile.in Wed Nov 25 10:05:50 2015
@@ -261,6 +261,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+INIT_VERSION = @INIT_VERSION@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -397,7 +398,6 @@ psdir = @psdir@
rivet_channel = @rivet_channel@
rivet_core = @rivet_core@
rivet_core_cmds = @rivet_core_cmds@
-runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
Modified: tcl/rivet/branches/2.2/configure.ac
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/configure.ac?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/configure.ac (original)
+++ tcl/rivet/branches/2.2/configure.ac Wed Nov 25 10:05:50 2015
@@ -791,6 +791,7 @@ VERSION=${PACKAGE_VERSION}
AX_SPLIT_VERSION
AC_DEFINE_UNQUOTED(TCL_PACKAGE_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}",[Rivet Tcl package version])
AC_MSG_NOTICE([Rivet package version is ${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}])
+AC_SUBST(INIT_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}")
if test $import_rivet_commands = "yes"; then
AC_MSG_NOTICE([forcing Rivet to export commands from ::rivet namespace])
@@ -818,7 +819,7 @@ AC_SUBST(TCL_PACKAGE_PATH)
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting the AC variables in. Include these here.
#--------------------------------------------------------------------
-AC_CONFIG_FILES([Makefile src/Makefile rivet/init.tcl src/parser/Makefile doc/Makefile doc/convert_examples.tcl])
+AC_CONFIG_FILES([Makefile src/Makefile src/parser/Makefile doc/Makefile doc/convert_examples.tcl rivet/init.tcl])
#case $apache_version_dir in
# apache-1) AC_CONFIG_FILES([Makefile src/Makefile src/apache-1/Makefile doc/Makefile]) ;;
Modified: tcl/rivet/branches/2.2/doc/xml/commands.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/doc/xml/commands.xml?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/doc/xml/commands.xml (original)
+++ tcl/rivet/branches/2.2/doc/xml/commands.xml Wed Nov 25 10:05:50 2015
@@ -569,6 +569,56 @@
</refsect1>
</refentry>
+ <refentry id="exit">
+ <refnamediv>
+ <refname>exit</refname>
+ <refpurpose>terminate execution and child process</refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>::rivet::exit</command>
+ <arg>code</arg>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>Description</title>
+ <para>
+ Replaces Tcl's <command>exit</command> core command. <command>::rivet::exit</command>
+ interrupts execution of the current script and passes execution to AbortScript if
+ such script is set. After AbortScript has finished and request processing completed
+ the child process is forced to exit by calling Tcl_Exit producing the same final
+ effect of the core command. During an <command>AbortScript</command> execution the
+ exit condition can be detected
+ <programlisting>if {[<command>::rivet::abort_page -exiting</command>]} {
+...handle exit condition
+}</programlisting>
+ </para>
+ <para>
+ <command>::rivet::exit</command> has a single optional argument <arg>code</arg>. This
+ value must be a positive integer number to be passed to Tcl_Exit. If any other value is
+ given <arg>code</arg> is set to 0. The exit code can be obtained from the dictionary
+ returned by <command>::rivet::abort_code</command>
+ </para>
+ <programlisting>[::rivet::abort_code]
+<== return_code <arg>code</arg> error_code exit</programlisting>
+ <para>
+ We support this command in order to have a gentle way to terminate a request processing
+ before actually exit the child process and avoid an abrupt interruption of a request that
+ might leave an application in a inconsistent state. In some cases <command>::rivet::exit</command>
+ could be the only way to exit a process and force the Apache HTTP web server to start
+ a fresh one. Moreover the core <command>exit</command> could be called from third parties
+ software and you may not be aware of it. We thus decided to trap this command and give it
+ the most gentle behavior still preserving the its basic purpose.
+ </para>
+ <note>
+ Nonetheless we discourage the programmer to use such command, and suggest to focus on proper
+ application design and avoid such a drastic way to bail out.
+ If you need to restart the child processes from time to time we recommend to check the
+ MaxRequests parameter in the
+ <ulink url="https://httpd.apache.org/docs/2.4/mod/prefork.html">prefork MPM documentation</ulink>
+ </note>
+ </refsect1>
+ </refentry>
<refentry id="headers">
<refnamediv>
@@ -577,17 +627,17 @@
</refnamediv>
<refsynopsisdiv>
- <cmdsynopsis>
- <command>::rivet::headers</command>
- <group choice="req">
- <arg>get</arg>
- <arg>set</arg>
- <arg>redirect</arg>
- <arg>add</arg>
- <arg>type</arg>
- <arg>numeric</arg>
- </group>
- </cmdsynopsis>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <group choice="req">
+ <arg>get</arg>
+ <arg>set</arg>
+ <arg>redirect</arg>
+ <arg>add</arg>
+ <arg>type</arg>
+ <arg>numeric</arg>
+ </group>
+ </cmdsynopsis>
</refsynopsisdiv>
<refsect1>
Modified: tcl/rivet/branches/2.2/rivet/init.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/rivet/init.tcl?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/rivet/init.tcl (original)
+++ tcl/rivet/branches/2.2/rivet/init.tcl Wed Nov 25 10:05:50 2015
@@ -40,25 +40,19 @@ namespace eval ::Rivet {
set dir $tclpath
source [file join $tclpath tclIndex]
- }
-
- set command_list [namespace eval ::rivet_temp {array names auto_index}]
- # commands in 'command_list' are prefixed with ::rivet, so we have to
- # remove it to build an export list
-
- set export_list {}
- foreach c $command_list {
- if {[regexp {::rivet::(.*)} $c m cmd]} {
- lappend export_list $cmd
-# namespace eval ::rivet [list namespace export $cmd]
- }
+ # Rivet Tcl commands not meant to go onto the export list must
+ # be unset from auto_index here
+
+ unset auto_index(::rivet::catch)
}
+ set command_list [namespace eval ::rivet_temp {array names auto_index}]
+
# we won't left anything behind
namespace delete ::rivet_temp
- return $export_list
+ return $command_list
}
###
@@ -125,7 +119,7 @@ namespace eval ::Rivet {
## we keep in ::rivet::export_list a list of importable commands
- namespace eval ::rivet [list set export_list [tcl_commands_export_list $tclpath]]
+ namespace eval ::rivet [list set cmd_export_list [tcl_commands_export_list $tclpath]]
namespace eval ::rivet {
## init.tcl is run by mod_rivet (which creates the ::rivet namespace) but it gets run
@@ -135,9 +129,18 @@ namespace eval ::Rivet {
if {[info exists module_conf(export_namespace_commands)] && \
$module_conf(export_namespace_commands)} {
+ # commands in 'command_list' are prefixed with ::rivet, so we have to
+ # remove it to build an export list
+
+ set export_list {}
+ foreach c $cmd_export_list {
+ lappend export_list [namespace tail $c]
+ }
+
+ #puts stderr "exporting $export_list"
eval namespace export $export_list
- }
+ }
}
## Add the packages directory to the auto_path.
## If we have a packages$tcl_version directory
@@ -166,7 +169,7 @@ namespace eval ::Rivet {
} ;## namespace eval ::Rivet
-## eventually we have to divert Tcl ::exit to ::rivet::exit_thread
+## eventually we have to divert Tcl ::exit to ::rivet::exit
rename ::exit ::Rivet::tclcore_exit
proc ::exit {code} {
@@ -191,15 +194,15 @@ interp alias {} ::incr0 {} incr
::Rivet::init
## And now we get to the import of the whole ::rivet namespace.
-## Some commands (namely lassign) replace the native lassign command
-## so we have to use the -force switch
# Do we actually want to import everything? If Rivet was configured
# to import the ::rivet namespace for compatibility we do it right away.
# This option is not guaranteed to be supported in future versions.
if {[info exists module_conf(import_rivet_commands)] && $module_conf(import_rivet_commands)} {
- namespace eval :: { namespace import -force ::rivet::* }
+
+ namespace eval :: { namespace import ::rivet::* }
+
}
array unset module_conf
Modified: tcl/rivet/branches/2.2/rivet/init.tcl.in
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/rivet/init.tcl.in?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/rivet/init.tcl.in (original)
+++ tcl/rivet/branches/2.2/rivet/init.tcl.in Wed Nov 25 10:05:50 2015
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-package provide Rivet 2.2
+package provide Rivet @INIT_VERSION@
namespace eval ::Rivet {
@@ -40,25 +40,19 @@ namespace eval ::Rivet {
set dir $tclpath
source [file join $tclpath tclIndex]
- }
-
- set command_list [namespace eval ::rivet_temp {array names auto_index}]
- # commands in 'command_list' are prefixed with ::rivet, so we have to
- # remove it to build an export list
-
- set export_list {}
- foreach c $command_list {
- if {[regexp {::rivet::(.*)} $c m cmd]} {
- lappend export_list $cmd
-# namespace eval ::rivet [list namespace export $cmd]
- }
+ # Rivet Tcl commands not meant to go onto the export list must
+ # be unset from auto_index here
+
+ unset auto_index(::rivet::catch)
}
+ set command_list [namespace eval ::rivet_temp {array names auto_index}]
+
# we won't left anything behind
namespace delete ::rivet_temp
- return $export_list
+ return $command_list
}
###
@@ -125,7 +119,7 @@ namespace eval ::Rivet {
## we keep in ::rivet::export_list a list of importable commands
- namespace eval ::rivet [list set export_list [tcl_commands_export_list $tclpath]]
+ namespace eval ::rivet [list set cmd_export_list [tcl_commands_export_list $tclpath]]
namespace eval ::rivet {
## init.tcl is run by mod_rivet (which creates the ::rivet namespace) but it gets run
@@ -135,9 +129,18 @@ namespace eval ::Rivet {
if {[info exists module_conf(export_namespace_commands)] && \
$module_conf(export_namespace_commands)} {
+ # commands in 'command_list' are prefixed with ::rivet, so we have to
+ # remove it to build an export list
+
+ set export_list {}
+ foreach c $cmd_export_list {
+ lappend export_list [namespace tail $c]
+ }
+
+ #puts stderr "exporting $export_list"
eval namespace export $export_list
- }
+ }
}
## Add the packages directory to the auto_path.
## If we have a packages$tcl_version directory
@@ -166,7 +169,7 @@ namespace eval ::Rivet {
} ;## namespace eval ::Rivet
-## eventually we have to divert Tcl ::exit to ::rivet::exit_thread
+## eventually we have to divert Tcl ::exit to ::rivet::exit
rename ::exit ::Rivet::tclcore_exit
proc ::exit {code} {
@@ -191,15 +194,15 @@ interp alias {} ::incr0 {} incr
::Rivet::init
## And now we get to the import of the whole ::rivet namespace.
-## Some commands (namely lassign) replace the native lassign command
-## so we have to use the -force switch
# Do we actually want to import everything? If Rivet was configured
# to import the ::rivet namespace for compatibility we do it right away.
# This option is not guaranteed to be supported in future versions.
if {[info exists module_conf(import_rivet_commands)] && $module_conf(import_rivet_commands)} {
- namespace eval :: { namespace import -force ::rivet::* }
+
+ namespace eval :: { namespace import ::rivet::* }
+
}
array unset module_conf
Modified: tcl/rivet/branches/2.2/rivet/rivet-tcl/catch.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/rivet/rivet-tcl/catch.tcl?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/rivet/rivet-tcl/catch.tcl (original)
+++ tcl/rivet/branches/2.2/rivet/rivet-tcl/catch.tcl Wed Nov 25 10:05:50 2015
@@ -1,12 +1,13 @@
-# catch.tcl
+# -- catch.tcl
#
# Wrapper of the core [::catch] command that checks whether
# an error condition is actually raised by [::rivet::abort_page]
# or [::rivet::exit]. In case the error is thrown again to allow
# the interpreter to interrupt and pass execution to AbortScript
#
-# $Id: $
+# $Id$
#
+
namespace eval ::rivet {
proc catch {script args} {
@@ -16,9 +17,8 @@ namespace eval ::rivet {
upvar [lindex $args 0] errvar
lappend catch_cmd errvar
-
}
- if {[llength $args] >= 2} {
+ if {[llength $args] == 2} {
upvar [lindex $args 1] catchopt
lappend catch_cmd catchopt
@@ -28,7 +28,11 @@ namespace eval ::rivet {
if {$catch_ret && [::rivet::abort_page -aborting]} {
- return -code error -errorcode ABORTPAGE
+ return -code error -errorcode ABORTPAGE 1
+
+ } elseif {$catch_ret && [::rivet::abort_page -exiting]} {
+
+ return -code error -errorcode EXITPAGE 1
} else {
Modified: tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c Wed Nov 25 10:05:50 2015
@@ -954,10 +954,6 @@ Rivet_PerInterpInit(server_rec *s, rivet
/* Watch out! Calling Tcl_PkgRequire with a version number binds this module to
* the Rivet package revision number in rivet/init.tcl
- *
- * RIVET_TCL_PACKAGE_VERSION is defined by configure.ac as the combination
- * "MAJOR_VERSION.MINOR_VERSION". We don't expect to change rivet/init.tcl
- * across patchlevel releases
*/
if (Tcl_PkgRequire(interp, "Rivet", RIVET_TCL_PACKAGE_VERSION, 1) == NULL)
Modified: tcl/rivet/branches/2.2/src/librivet/rivetCrypt.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/librivet/rivetCrypt.c?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/librivet/rivetCrypt.c (original)
+++ tcl/rivet/branches/2.2/src/librivet/rivetCrypt.c Wed Nov 25 10:05:50 2015
@@ -148,9 +148,9 @@ TCL_CMD_HEADER( Rivet_CryptCmd )
#endif /* ! crypt */
}
-
/*-----------------------------------------------------------------------------
* Rivet_initCrypt --
+ *
* Initialize the encrypt, decrypt and crypt commands in an interpreter.
*
* These routines have been examined and are believed to be safe in a safe
@@ -160,11 +160,28 @@ TCL_CMD_HEADER( Rivet_CryptCmd )
* o interp - Interpreter to add commands to.
*-----------------------------------------------------------------------------
*/
+
+#if RIVET_NAMESPACE_EXPORT == 1
+extern Tcl_Namespace* Rivet_GetNamespace( Tcl_Interp* interp);
+#endif
+
int
Rivet_InitCrypt( Tcl_Interp *interp)
{
RIVET_OBJ_CMD("encrypt", Rivet_EncryptCmd);
RIVET_OBJ_CMD("decrypt", Rivet_DecryptCmd);
RIVET_OBJ_CMD("crypt", Rivet_CryptCmd);
+
+#if RIVET_NAMESPACE_EXPORT == 1
+ {
+ Tcl_Namespace* rivet_ns = Rivet_GetNamespace(interp);
+
+ RIVET_EXPORT_CMD(interp,rivet_ns,"encrypt");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"decrypt");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"crypt");
+
+ }
+#endif
+
return TCL_OK;
}
Modified: tcl/rivet/branches/2.2/src/librivet/rivetList.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/librivet/rivetList.c?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/librivet/rivetList.c (original)
+++ tcl/rivet/branches/2.2/src/librivet/rivetList.c Wed Nov 25 10:05:50 2015
@@ -522,9 +522,9 @@ TCL_CMD_HEADER( Rivet_LassignArrayObjCmd
return TCL_OK;
}
-
/*-----------------------------------------------------------------------------
* Rivet_initList --
+ *
* Initialize the list commands in an interpreter.
*
* These routines have been examined and are believed to be safe in a safe
@@ -537,6 +537,10 @@ TCL_CMD_HEADER( Rivet_LassignArrayObjCmd
*-----------------------------------------------------------------------------
*/
+#if RIVET_NAMESPACE_EXPORT == 1
+extern Tcl_Namespace* Rivet_GetNamespace( Tcl_Interp* interp);
+#endif
+
int
Rivet_InitList( Tcl_Interp *interp)
{
@@ -544,6 +548,14 @@ Rivet_InitList( Tcl_Interp *interp)
RIVET_OBJ_CMD("comma_split",Rivet_CommaSplitObjCmd);
RIVET_OBJ_CMD("comma_join",Rivet_CommaJoinObjCmd);
RIVET_OBJ_CMD("lassign_array",Rivet_LassignArrayObjCmd);
-
+#if RIVET_NAMESPACE_EXPORT == 1
+ {
+ Tcl_Namespace* rivet_ns = Rivet_GetNamespace(interp);
+ RIVET_EXPORT_CMD(interp,rivet_ns,"lremove");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"comma_split");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"comma_join");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"lassign_array");
+ }
+#endif
return TCL_OK;
}
Modified: tcl/rivet/branches/2.2/src/librivet/rivetPkgInit.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/librivet/rivetPkgInit.c?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/librivet/rivetPkgInit.c (original)
+++ tcl/rivet/branches/2.2/src/librivet/rivetPkgInit.c Wed Nov 25 10:05:50 2015
@@ -49,8 +49,7 @@
#if RIVET_NAMESPACE_EXPORT == 1
-static Tcl_Namespace*
-Rivet_GetNamespace( Tcl_Interp* interp)
+Tcl_Namespace* Rivet_GetNamespace( Tcl_Interp* interp)
{
rivet_interp_globals *globals;
Tcl_Namespace *rivet_ns;
@@ -91,7 +90,7 @@ int
Rivetlib_Init( Tcl_Interp *interp )
{
#if RIVET_NAMESPACE_EXPORT == 1
- Tcl_Namespace *rivet_ns;
+ //Tcl_Namespace *rivet_ns;
#endif
#ifdef USE_TCL_STUBS
@@ -106,8 +105,8 @@ Rivetlib_Init( Tcl_Interp *interp )
Rivet_InitCrypt(interp);
Rivet_InitWWW (interp);
#if RIVET_NAMESPACE_EXPORT == 1
- rivet_ns = Rivet_GetNamespace(interp);
- Tcl_Export(interp,rivet_ns,"*",0);
+ //rivet_ns = Rivet_GetNamespace(interp);
+ //Tcl_Export(interp,rivet_ns,"*",0);
#endif
return Tcl_PkgProvide( interp, RIVETLIB_TCL_PACKAGE, RIVET_VERSION );
@@ -128,10 +127,6 @@ Rivetlib_Init( Tcl_Interp *interp )
int
Rivetlib_SafeInit( Tcl_Interp *interp )
{
-#if RIVET_NAMESPACE_EXPORT == 1
- Tcl_Namespace *rivet_ns;
-#endif
-
#ifdef USE_TCL_STUBS
if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
#else
@@ -144,9 +139,5 @@ Rivetlib_SafeInit( Tcl_Interp *interp )
Rivet_InitCrypt(interp);
Rivet_InitWWW(interp);
-#if RIVET_NAMESPACE_EXPORT == 1
- rivet_ns = Rivet_GetNamespace(interp);
- Tcl_Export(interp,rivet_ns,"*",0);
-#endif
return Tcl_PkgProvide( interp, RIVETLIB_TCL_PACKAGE, RIVET_VERSION );
}
Modified: tcl/rivet/branches/2.2/src/librivet/rivetWWW.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/librivet/rivetWWW.c?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/librivet/rivetWWW.c (original)
+++ tcl/rivet/branches/2.2/src/librivet/rivetWWW.c Wed Nov 25 10:05:50 2015
@@ -350,6 +350,9 @@ TCL_CMD_HEADER( Rivet_EscapeShellCommand
* in safe interpreters, as they process strings only.
*-----------------------------------------------------------------------------
*/
+#if RIVET_NAMESPACE_EXPORT == 1
+extern Tcl_Namespace* Rivet_GetNamespace( Tcl_Interp* interp);
+#endif
int
Rivet_InitWWW( Tcl_Interp *interp)
@@ -358,5 +361,16 @@ Rivet_InitWWW( Tcl_Interp *interp)
RIVET_OBJ_CMD ("escape_string",Rivet_EscapeStringCmd);
RIVET_OBJ_CMD ("escape_sgml_chars",Rivet_EscapeSgmlCharsCmd);
RIVET_OBJ_CMD ("escape_shell_command",Rivet_EscapeShellCommandCmd);
+
+#if RIVET_NAMESPACE_EXPORT == 1
+ {
+ Tcl_Namespace* rivet_ns = Rivet_GetNamespace(interp);
+
+ RIVET_EXPORT_CMD(interp,rivet_ns,"unescape_string");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"escape_string");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"escape_sgml_chars");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"escape_shell_command");
+ }
+#endif
return TCL_OK;
}
Modified: tcl/rivet/branches/2.2/src/rivet.h
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/rivet.h?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/rivet.h (original)
+++ tcl/rivet/branches/2.2/src/rivet.h Wed Nov 25 10:05:50 2015
@@ -54,6 +54,10 @@ Tcl_CreateObjCommand( interp, /* Tcl int
NULL, /* Client Data */\
(Tcl_CmdDeleteProc *)NULL /* Tcl Delete Prov */);
+#define RIVET_EXPORT_CMD(interp,ns,cmdname) Tcl_Export(interp,ns,cmdname,0);
+
+//Tcl_ListObjAppendElement(interp,export_l,Tcl_NewStringObj(RIVET_NS "::" cmdname,-1));
+
/*
* Pointer in r is checked and in case Rivet_NoRequestRec is
* called returning TCL_ERROR. This macro is used (and often
Modified: tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c (original)
+++ tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c Wed Nov 25 10:05:50 2015
@@ -58,8 +58,6 @@ extern char* TclWeb_GetRawPost (TclWebRe
#define POOL (globals->r->pool)
-
-
/*
* -- Rivet_NoRequestRec
*
@@ -1685,14 +1683,6 @@ TestpanicCmd(dummy, interp, argc, argv)
int
Rivet_InitCore( Tcl_Interp *interp )
{
-#if RIVET_NAMESPACE_EXPORT == 1
- rivet_interp_globals *globals = NULL;
- Tcl_Namespace *rivet_ns;
-
- globals = Tcl_GetAssocData(interp, "rivet", NULL);
- rivet_ns = globals->rivet_ns;
-#endif
-
RIVET_OBJ_CMD ("makeurl",Rivet_MakeURL);
RIVET_OBJ_CMD ("headers",Rivet_Headers);
RIVET_OBJ_CMD ("load_env",Rivet_LoadEnv);
@@ -1719,7 +1709,34 @@ Rivet_InitCore( Tcl_Interp *interp )
#endif
#if RIVET_NAMESPACE_EXPORT == 1
- Tcl_Export(interp,rivet_ns,"*",0);
+ {
+ rivet_interp_globals *globals = NULL;
+ Tcl_Namespace* rivet_ns;
+
+ globals = Tcl_GetAssocData(interp, "rivet", NULL);
+ rivet_ns = globals->rivet_ns;
+
+ RIVET_EXPORT_CMD(interp,rivet_ns,"makeurl");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"headers");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"load_env");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"load_headers");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"var");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"abort_page");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"abort_code");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"virtual_filename");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"apache_table");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"var_qs");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"var_post");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"raw_post");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"upload");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"include");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"parse");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"no_body");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"env");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"apache_log_error");
+ RIVET_EXPORT_CMD(interp,rivet_ns,"inspect");
+ }
+ // ::rivet::exit is not exported
#endif
// return Tcl_PkgProvide( interp,RIVET_TCL_PACKAGE,"1.2");
Modified: tcl/rivet/branches/2.2/tests/bailout.test
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/tests/bailout.test?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/tests/bailout.test (original)
+++ tcl/rivet/branches/2.2/tests/bailout.test Wed Nov 25 10:05:50 2015
@@ -11,7 +11,6 @@
RivetServerConf AbortScript "set tmpfp \[open redirect_code.txt w+\]"
RivetServerConf AbortScript "puts \$tmpfp \[::rivet::abort_code\]"
RivetServerConf AbortScript "close \$tmpfp"
- #RivetServerConf AbortScript "touch /tmp/aaaaaa"
} {
set url "${urlbase}redirect.rvt?base=$urlbase"
#puts $url
@@ -30,7 +29,8 @@
apachetest::start {} {
RivetServerConf AbortScript "::rivet::apache_log_error err \\\"catching exit\\\""
RivetServerConf AbortScript "set abcode \[::rivet::abort_code\]"
- RivetServerConf AbortScript "puts -nonewline \\\"\[dict get \$abcode error_code\] \[dict get \$abcode return_code\]\\\""
+ RivetServerConf AbortScript "puts -nonewline \[::rivet::abort_page -exiting\]"
+ RivetServerConf AbortScript "puts -nonewline \\\" \[dict get \$abcode error_code\] \[dict get \$abcode return_code\]\\\""
} {
puts "test exit command"
set url "${urlbase}exit.tcl"
@@ -39,5 +39,7 @@
::http::cleanup $page
}
set r
-} {exit 100}
+} {1 exit 100}
+
+
Modified: tcl/rivet/branches/2.2/tests/rivet.test
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/tests/rivet.test?rev=1716344&r1=1716343&r2=1716344&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/tests/rivet.test (original)
+++ tcl/rivet/branches/2.2/tests/rivet.test Wed Nov 25 10:05:50 2015
@@ -59,8 +59,7 @@ if { $testgroup2 } {
# These tests start the server on their own, or don't need the server
# at all.
-if { $testgroup3 } {
- foreach Test {
+set TestList {
failtest.test
broken.test
config.test
@@ -69,7 +68,10 @@ if { $testgroup3 } {
inspect.test
bailout.test
channel.test
- } {
+ }
+
+if { $testgroup3 } {
+ foreach Test $TestList {
puts "Running $Test"
source $Test
}
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org