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 2014/08/09 17:29:08 UTC
svn commit: r1616967 [1/2] - in /tcl/rivet/trunk: ./ src/apache-2/
src/common/ src/experimental/
Author: mxmanghi
Date: Sat Aug 9 15:29:07 2014
New Revision: 1616967
URL: http://svn.apache.org/r1616967
Log:
* src/apache-2/mod_rivet.c: Various functions moved to src/common/mod_rivet_common.c
* configure.ac: --with-rivet-core switch simplified
* Makefile.am: preparing for installation of MPM bridges which have not to be scanned for Tcl packages
* NOTICE: now Apache policy compliant
* src/apache-2/Makefile.am: reenabled and reworked to make paths relative
* src/apache-2/mod_rivet.h: reworked to reflect the new code organization. Also some definitions
moved here from mod_rivet.c
* src/common/mod_rivet_common.c: this is now the place where mod_rivet implementation independent
function must go
* src/experimental/Makefile.am: adding build for rivet_prefork_mpm.so
* src/experimental/mod_rivet.[c|h]: placing here only the hopefully necessary code. The module
resolves the bridge module symbols and actually calls those function to initialize, respond to
requests and exit child processes
* src/experimental/rivet_prefork_mpm.c: first sccessful implementation of the prefork bridge
* src/experimental/rivet_worker_mpm.c: stuffing code into this module. It doesn't build now
* src/common/mod_rivet_common.h: definitions for functions stored here.
Added:
tcl/rivet/trunk/src/common/mod_rivet_common.h
tcl/rivet/trunk/src/experimental/rivet_prefork_mpm.c (with props)
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/Makefile.am
tcl/rivet/trunk/Makefile.in
tcl/rivet/trunk/NOTICE
tcl/rivet/trunk/configure.ac
tcl/rivet/trunk/src/apache-2/Makefile.am
tcl/rivet/trunk/src/apache-2/mod_rivet.c
tcl/rivet/trunk/src/apache-2/mod_rivet.h
tcl/rivet/trunk/src/common/apache_config.h
tcl/rivet/trunk/src/common/mod_rivet_common.c
tcl/rivet/trunk/src/experimental/Makefile.am
tcl/rivet/trunk/src/experimental/mod_rivet.c
tcl/rivet/trunk/src/experimental/mod_rivet.h
tcl/rivet/trunk/src/experimental/rivetChannel.h
tcl/rivet/trunk/src/experimental/rivet_worker_mpm.c (contents, props changed)
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Sat Aug 9 15:29:07 2014
@@ -1,4 +1,22 @@
-2014-08-05: Massimo Manghi <mx...@apache.org>
+2014-08-09 Massimo Manghi <mx...@apache.org>
+ * src/apache-2/mod_rivet.c: Various functions moved to src/common/mod_rivet_common.c
+ * configure.ac: --with-rivet-core switch simplified
+ * Makefile.am: preparing for installation of MPM bridges which have not to be scanned for Tcl packages
+ * NOTICE: now Apache policy compliant
+ * src/apache-2/Makefile.am: reenabled and reworked to make paths relative
+ * src/apache-2/mod_rivet.h: reworked to reflect the new code organization. Also some definitions
+ moved here from mod_rivet.c
+ * src/common/mod_rivet_common.c: this is now the place where mod_rivet implementation independent
+ function must go
+ * src/experimental/Makefile.am: adding build for rivet_prefork_mpm.so
+ * src/experimental/mod_rivet.[c|h]: placing here only the hopefully necessary code. The module
+ resolves the bridge module symbols and actually calls those function to initialize, respond to
+ requests and exit child processes
+ * src/experimental/rivet_prefork_mpm.c: first sccessful implementation of the prefork bridge
+ * src/experimental/rivet_worker_mpm.c: stuffing code into this module. It doesn't build now
+ * src/common/mod_rivet_common.h: definitions for functions stored here.
+
+2014-08-05 Massimo Manghi <mx...@apache.org>
* src/apache-2/Makefile.am: build of mod_rivet moved again into the directory containing the code
* configure.ac: new symbol RIVET_SOURCE_BASE pointing to <rivet-root>/src/, various fixes,
generation of Makefile.in in both src/apache-2 and src/experimental
@@ -12,7 +30,7 @@
rivet_worker_mpm.so
* tclconfig/: new version of scripts
-2014-08-04: Massimo Manghi <mx...@apache.org>
+2014-08-04 Massimo Manghi <mx...@apache.org>
* src/common: renaming src/config to a more specific name
2014-07-31: Massimo Manghi <mx...@apache.org>
Modified: tcl/rivet/trunk/Makefile.am
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/Makefile.am?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/Makefile.am (original)
+++ tcl/rivet/trunk/Makefile.am Sat Aug 9 15:29:07 2014
@@ -28,7 +28,7 @@ install-binaries:
cp -v rivet/init.tcl $(RIVETLIB_DESTDIR)/
cp -rv rivet/rivet-tcl $(RIVETLIB_DESTDIR)/
-( cd $(RIVETLIB_DESTDIR); rm -f *.la; \
- echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH) *[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
uninstall-local:
rm -f $(RIVETLIB_DESTDIR)/init.tcl
@@ -46,7 +46,7 @@ install-packages:
cp -rv rivet/packages/* $(RIVET_PACKAGES)
-( cd $(RIVETLIB_DESTDIR); \
echo 'eval file delete [glob [file join packages * pkgIndex.tcl]] pkgIndex.tcl' | @TCLSH_PROG@ ; \
- echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH) *[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
uninstall-packages:
rm -fr $(RIVET_PACKAGES)
@@ -55,7 +55,7 @@ uninstall-packages:
@rmdir $(RIVETLIB_DESTDIR); \
fi
-( cd $(RIVETLIB_DESTDIR); \
- echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH) *[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
#
distclean-local:
Modified: tcl/rivet/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/Makefile.in?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/Makefile.in (original)
+++ tcl/rivet/trunk/Makefile.in Sat Aug 9 15:29:07 2014
@@ -90,7 +90,8 @@ host_triplet = @host@
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
- $(srcdir)/config.h.in $(top_srcdir)/${rivet_core}/Makefile.in \
+ $(srcdir)/config.h.in \
+ $(top_srcdir)/src/${rivet_core}/Makefile.in \
$(top_srcdir)/rivet/init.tcl.in ChangeLog tclconfig/ChangeLog \
INSTALL README TODO tclconfig/compile tclconfig/config.guess \
tclconfig/config.sub tclconfig/depcomp tclconfig/install-sh \
@@ -114,7 +115,7 @@ am__CONFIG_DISTCLEAN_FILES = config.stat
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = ${rivet_core}/Makefile rivet/init.tcl
+CONFIG_CLEAN_FILES = src/${rivet_core}/Makefile rivet/init.tcl
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -469,7 +470,7 @@ $(srcdir)/config.h.in: $(am__configure_
distclean-hdr:
-rm -f config.h stamp-h1
-${rivet_core}/Makefile: $(top_builddir)/config.status $(top_srcdir)/${rivet_core}/Makefile.in
+src/${rivet_core}/Makefile: $(top_builddir)/config.status $(top_srcdir)/src/${rivet_core}/Makefile.in
cd $(top_builddir) && $(SHELL) ./config.status $@
rivet/init.tcl: $(top_builddir)/config.status $(top_srcdir)/rivet/init.tcl.in
cd $(top_builddir) && $(SHELL) ./config.status $@
@@ -913,7 +914,7 @@ install-binaries:
cp -v rivet/init.tcl $(RIVETLIB_DESTDIR)/
cp -rv rivet/rivet-tcl $(RIVETLIB_DESTDIR)/
-( cd $(RIVETLIB_DESTDIR); rm -f *.la; \
- echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH) *[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
uninstall-local:
rm -f $(RIVETLIB_DESTDIR)/init.tcl
@@ -931,7 +932,7 @@ install-packages:
cp -rv rivet/packages/* $(RIVET_PACKAGES)
-( cd $(RIVETLIB_DESTDIR); \
echo 'eval file delete [glob [file join packages * pkgIndex.tcl]] pkgIndex.tcl' | @TCLSH_PROG@ ; \
- echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH) *[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
uninstall-packages:
rm -fr $(RIVET_PACKAGES)
@@ -940,7 +941,7 @@ uninstall-packages:
@rmdir $(RIVETLIB_DESTDIR); \
fi
-( cd $(RIVETLIB_DESTDIR); \
- echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH) *[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
#
distclean-local:
Modified: tcl/rivet/trunk/NOTICE
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/NOTICE?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/NOTICE (original)
+++ tcl/rivet/trunk/NOTICE Sat Aug 9 15:29:07 2014
@@ -1,2 +1,6 @@
+Apache Rivet
+
+Copyright 2014 The Apache Software Foundation
+
This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
+The Apache Software Foundation (http://www.apache.org/).
Modified: tcl/rivet/trunk/configure.ac
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/configure.ac?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/configure.ac (original)
+++ tcl/rivet/trunk/configure.ac Sat Aug 9 15:29:07 2014
@@ -436,12 +436,15 @@ AC_DEFUN([MOD_RIVET_CORE],[
AC_MSG_CHECKING(mod_rivet core)
- if [[ -d "src/${with_rivet_core}" ]]; then
- rivet_core=$(pwd)/src/${with_rivet_core}
- else
- rivet_core=${with_rivet_core}
- fi
- AC_CONFIG_FILES([${rivet_core}/Makefile])
+ #if [[ -d "src/${with_rivet_core}" ]]; then
+ # rivet_core=$(pwd)/src/${with_rivet_core}
+ #else
+ # rivet_core=${with_rivet_core}
+ #fi
+
+ rivet_core=${with_rivet_core}
+
+ AC_CONFIG_FILES([src/${rivet_core}/Makefile])
AC_SUBST(rivet_core)
AC_MSG_RESULT([$rivet_core])
])
Modified: tcl/rivet/trunk/src/apache-2/Makefile.am
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/Makefile.am?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/Makefile.am (original)
+++ tcl/rivet/trunk/src/apache-2/Makefile.am Sat Aug 9 15:29:07 2014
@@ -33,4 +33,4 @@ mod_rivet_la_SOURCES = mod_rivet.c
mod_rivet_la_LDFLAGS = @TCL_LIB_SPEC@ @APXS_LDFLAGS@ @APR_LDFLAGS@ -module -avoid-version
mod_rivet_la_LIBADD = @TCL_LIBS@ @APXS_LIBS@
-mod_rivet_la_CPPFLAGS = -I@rivet_core@ -I@rivet_channel@ -I@RIVET_BASE_INCLUDE@/common -I@RIVET_BASE_INCLUDE@/parser -I@apache_request@ @apache_include@ -I@RIVET_BASE_INCLUDE@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_CPPFLAGS@ @APR_INCLUDES@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"'
+mod_rivet_la_CPPFLAGS = -I@rivet_core@ -I../@rivet_channel@ -I@RIVET_BASE_INCLUDE@/common -I@RIVET_BASE_INCLUDE@/parser -I../@apache_request@ @apache_include@ -I@RIVET_BASE_INCLUDE@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_CPPFLAGS@ @APR_INCLUDES@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"'
Modified: tcl/rivet/trunk/src/apache-2/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/mod_rivet.c?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/apache-2/mod_rivet.c Sat Aug 9 15:29:07 2014
@@ -1,18 +1,22 @@
/* mod_rivet.c -- The apache module itself, for Apache 2.x. */
-/* Copyright 2000-2005 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
/* $Id$ */
@@ -43,8 +47,6 @@
#include <apr_strings.h>
#include <apr_tables.h>
-#include <ap_mpm.h>
-
/* Tcl includes */
#include <tcl.h>
/* There is code ifdef'ed out below which uses internal
@@ -53,20 +55,14 @@
/* Rivet Includes */
#include "mod_rivet.h"
+#include "mod_rivet_common.h"
#include "rivet.h"
#include "rivetParser.h"
#include "rivetChannel.h"
#include "apache_config.h"
-#define MODNAME "mod_rivet"
-
//module AP_MODULE_DECLARE_DATA rivet_module;
-/* This is used *only* in the PanicProc. Otherwise, don't touch it! */
-static request_rec *rivet_panic_request_rec = NULL;
-static apr_pool_t *rivet_panic_pool = NULL;
-static server_rec *rivet_panic_server_rec = NULL;
-
/* Need some arbitrary non-NULL pointer which can't also be a request_rec */
#define NESTED_INCLUDE_MAGIC (&rivet_module)
#define DEBUG(s) fprintf(stderr, s), fflush(stderr)
@@ -77,189 +73,360 @@ static server_rec *rivet_panic_server_
TCL_DECLARE_MUTEX(sendMutex);
-#define RIVET_TEMPLATE_CTYPE "application/x-httpd-rivet"
-#define RIVET_TCLFILE_CTYPE "application/x-rivet-tcl"
-
-/*
- * for some reason the max buffer size definition is not exported by Tcl
- * we steal and reproduce it here prepending the name with TCL
- */
-
-#define TCL_MAX_CHANNEL_BUFFER_SIZE (1024*1024)
-
-static Tcl_Interp* Rivet_CreateTclInterp (server_rec* s);
-static void Rivet_CreateCache (server_rec *s, apr_pool_t *p);
+static Tcl_Interp* Rivet_CreateTclInterp (server_rec* s);
static apr_status_t Rivet_ChildExit(void *data);
mod_rivet_globals* rivet_module_globals = NULL;
-/*
- * -- Rivet_InitServerVariables
+/* -- Rivet_ExecuteAndCheck
+ *
+ * Tcl script execution central procedure. The script stored
+ * outbuf is evaluated and in case an error occurs in the execution
+ * an error handler is executed. In case the error code returned
+ * is RIVET then the error was caused by the invocation of a
+ * abort_page command and the script stored in conf->abort_script
+ * is run istead. The default error script prints the error buffer
+ *
+ * Arguments:
+ *
+ * - Tcl_Interp* interp: the Tcl interpreter
+ * - Tcl_Obj* tcl_script_obj: a pointer to the Tcl_Obj holding the script
+ * - request_rec* req: the current request_rec object pointer
+ *
+ * Returned value:
+ *
+ * - invariably TCL_OK
+ *
+ * Side effects:
*
- * Setup an array in each interpreter to tell us things about Apache.
- * This saves us from having to do any real call to load an entire
- * environment. This routine only gets called once, when the child process
- * is created.
- *
- * Arguments:
- *
- * Tcl_Interp* interp: pointer to the Tcl interpreter
- * apr_pool_t* pool: pool used for calling Apache framework functions
- *
- * Returned value:
- * none
- *
- * Side effects:
- *
- * within the global scope of the interpreter passed as first
- * argument a 'server' array is created and the variable associated
- * to the following keys are defined
- *
- * SERVER_ROOT - Apache's root location
- * SERVER_CONF - Apache's configuration file
- * RIVET_DIR - Rivet's Tcl source directory
- * RIVET_INIT - Rivet's init.tcl file
- * RIVET_VERSION - Rivet version (only when RIVET_DISPLAY_VERSION is 1)
- * MPM_THREADED - It should contain the string 'unsupported' for a prefork MPM
- * MPM_FORKED - String describing the forking model of the MPM
+ * The Tcl interpreter internal status is changed by the execution
+ * of the script
*
*/
-static void
-Rivet_InitServerVariables( Tcl_Interp *interp, apr_pool_t *pool )
+static int
+Rivet_ExecuteAndCheck(Tcl_Interp *interp, Tcl_Obj *tcl_script_obj, request_rec *req)
{
- int ap_mpm_result;
- Tcl_Obj *obj;
+ rivet_server_conf *conf = Rivet_GetConf(req);
+ rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL);
- obj = Tcl_NewStringObj(ap_server_root, -1);
- Tcl_IncrRefCount(obj);
- Tcl_SetVar2Ex(interp,
- "server",
- "SERVER_ROOT",
- obj,
- TCL_GLOBAL_ONLY);
- Tcl_DecrRefCount(obj);
-
- obj = Tcl_NewStringObj(ap_server_root_relative(pool,SERVER_CONFIG_FILE), -1);
- Tcl_IncrRefCount(obj);
- Tcl_SetVar2Ex(interp,
- "server",
- "SERVER_CONF",
- obj,
- TCL_GLOBAL_ONLY);
- Tcl_DecrRefCount(obj);
-
- obj = Tcl_NewStringObj(ap_server_root_relative(pool, RIVET_DIR), -1);
- Tcl_IncrRefCount(obj);
- Tcl_SetVar2Ex(interp,
- "server",
- "RIVET_DIR",
- obj,
- TCL_GLOBAL_ONLY);
- Tcl_DecrRefCount(obj);
-
- obj = Tcl_NewStringObj(ap_server_root_relative(pool, RIVET_INIT), -1);
- Tcl_IncrRefCount(obj);
- Tcl_SetVar2Ex(interp,
- "server",
- "RIVET_INIT",
- obj,
- TCL_GLOBAL_ONLY);
- Tcl_DecrRefCount(obj);
+ Tcl_Preserve (interp);
+ if ( Tcl_EvalObjEx(interp, tcl_script_obj, 0) == TCL_ERROR ) {
+ Tcl_Obj *errscript;
+ Tcl_Obj *errorCodeListObj;
+ Tcl_Obj *errorCodeElementObj;
+ char *errorCodeSubString;
-#if RIVET_DISPLAY_VERSION
- obj = Tcl_NewStringObj(RIVET_VERSION, -1);
- Tcl_IncrRefCount(obj);
- Tcl_SetVar2Ex(interp,
- "server",
- "RIVET_VERSION",
- obj,
- TCL_GLOBAL_ONLY);
- Tcl_DecrRefCount(obj);
-#endif
+ /* There was an error, see if it's from Rivet and it was caused
+ * by abort_page.
+ */
- if (ap_mpm_query(AP_MPMQ_IS_THREADED,&ap_mpm_result) == APR_SUCCESS)
- {
- switch (ap_mpm_result)
- {
- case AP_MPMQ_STATIC:
- obj = Tcl_NewStringObj("static", -1);
- break;
- case AP_MPMQ_NOT_SUPPORTED:
- obj = Tcl_NewStringObj("unsupported", -1);
- break;
- default:
- obj = Tcl_NewStringObj("undefined", -1);
- break;
+ errorCodeListObj = Tcl_GetVar2Ex (interp, "errorCode", (char *)NULL, TCL_GLOBAL_ONLY);
+
+ /* errorCode is guaranteed to be set to NONE, but let's make sure
+ * anyway rather than causing a SIGSEGV
+ */
+ ap_assert (errorCodeListObj != (Tcl_Obj *)NULL);
+
+ /* dig the first element out of the errorCode list and see if it
+ * says Rivet -- this shouldn't fail either, but let's assert
+ * success so we don't get a SIGSEGV afterwards */
+ ap_assert (Tcl_ListObjIndex (interp, errorCodeListObj, 0, &errorCodeElementObj) == TCL_OK);
+
+ /* if the error was thrown by Rivet, see if it's abort_page and,
+ * if so, don't treat it as an error, i.e. don't execute the
+ * installed error handler or the default one, just check if
+ * a rivet_abort_script is defined, otherwise the page emits
+ * as normal
+ */
+ if (strcmp (Tcl_GetString (errorCodeElementObj), "RIVET") == 0) {
+
+ /* dig the second element out of the errorCode list, make sure
+ * it succeeds -- it should always
+ */
+ ap_assert (Tcl_ListObjIndex (interp, errorCodeListObj, 1, &errorCodeElementObj) == TCL_OK);
+
+ errorCodeSubString = Tcl_GetString (errorCodeElementObj);
+ if (strcmp (errorCodeSubString, ABORTPAGE_CODE) == 0)
+ {
+ if (conf->rivet_abort_script)
+ {
+ if (Tcl_EvalObjEx(interp,conf->rivet_abort_script,0) == TCL_ERROR)
+ {
+ CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 );
+ TclWeb_PrintError("<b>Rivet AbortScript failed!</b>",1,globals->req);
+ TclWeb_PrintError( errorinfo, 0, globals->req );
+ }
+ }
+ goto good;
+ }
+ }
+
+ Tcl_SetVar( interp, "errorOutbuf",Tcl_GetStringFromObj( tcl_script_obj, NULL ),TCL_GLOBAL_ONLY );
+
+ /* If we don't have an error script, use the default error handler. */
+ if (conf->rivet_error_script ) {
+ errscript = conf->rivet_error_script;
+ } else {
+ errscript = conf->rivet_default_error_script;
}
- Tcl_IncrRefCount(obj);
- Tcl_SetVar2Ex(interp,"server","MPM_THREADED",obj,TCL_GLOBAL_ONLY);
- Tcl_DecrRefCount(obj);
+
+ Tcl_IncrRefCount(errscript);
+ if (Tcl_EvalObjEx(interp, errscript, 0) == TCL_ERROR) {
+ CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 );
+ TclWeb_PrintError("<b>Rivet ErrorScript failed!</b>",1,globals->req);
+ TclWeb_PrintError( errorinfo, 0, globals->req );
+ }
+
+ /* This shouldn't make the default_error_script go away,
+ * because it gets a Tcl_IncrRefCount when it is created. */
+ Tcl_DecrRefCount(errscript);
}
- if (ap_mpm_query(AP_MPMQ_IS_FORKED,&ap_mpm_result) == APR_SUCCESS)
- {
- switch (ap_mpm_result)
+ /* Make sure to flush the output if buffer_add was the only output */
+good:
+
+ if (conf->after_every_script) {
+ if (Tcl_EvalObjEx(interp,conf->after_every_script,0) == TCL_ERROR)
{
- case AP_MPMQ_STATIC:
- obj = Tcl_NewStringObj("static", -1);
- break;
- case AP_MPMQ_DYNAMIC:
- obj = Tcl_NewStringObj("dynamic", -1);
- break;
- default:
- obj = Tcl_NewStringObj("undefined", -1);
- break;
+ CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 );
+ TclWeb_PrintError("<b>Rivet AfterEveryScript failed!</b>",1,globals->req);
+ TclWeb_PrintError( errorinfo, 0, globals->req );
}
- Tcl_IncrRefCount(obj);
- Tcl_SetVar2Ex(interp,"server","MPM_FORKED",obj,TCL_GLOBAL_ONLY);
- Tcl_DecrRefCount(obj);
}
+
+ if (!globals->req->headers_set && (globals->req->charset != NULL)) {
+ TclWeb_SetHeaderType (apr_pstrcat(globals->req->req->pool,"text/html;",globals->req->charset,NULL),globals->req);
+ }
+ TclWeb_PrintHeaders(globals->req);
+ Tcl_Flush(*(conf->outchannel));
+ Tcl_Release(interp);
+
+ return TCL_OK;
}
-static void
-Rivet_CleanupRequest( request_rec *r )
+/*
+ * -- Rivet_ParseExecFile
+ *
+ * given a filename if the file exists it's either parsed (when a rivet
+ * template) and then executed as a Tcl_Obj instance or directly executed
+ * if a Tcl script.
+ *
+ * This is a separate function so that it may be called from command 'parse'
+ *
+ * Arguments:
+ *
+ * - TclWebRequest: pointer to the structure collecting Tcl and Apache data
+ * - filename: pointer to a string storing the path to the template or
+ * Tcl script
+ * - toplevel: integer to be interpreted as a boolean meaning the
+ * file is pointed by the request. When 0 that's a subtemplate
+ * to be parsed and executed from another template
+ */
+
+int
+Rivet_ParseExecFile(TclWebRequest *req, char *filename, int toplevel)
{
-#if 0
- apr_table_t *t;
- apr_array_header_t *arr;
- apr_table_entry_t *elts;
- int i, nelts;
- Tcl_Obj *arrayName;
- Tcl_Interp *interp;
-
- rivet_server_conf *rsc = RIVET_SERVER_CONF( r->per_dir_config );
-
- t = rsc->rivet_user_vars;
- arr = (apr_array_header_t*) apr_table_elts( t );
- elts = (apr_table_entry_t *) arr->elts;
- nelts = arr->nelts;
- arrayName = Tcl_NewStringObj( "RivetUserConf", -1 );
- interp = rsc->server_interp;
+ char *hashKey = NULL;
+ int isNew = 0;
+ int result = 0;
- for( i = 0; i < nelts; ++i )
- {
- Tcl_UnsetVar2(interp,
- "RivetUserConf",
- elts[i].key,
- TCL_GLOBAL_ONLY);
+ Tcl_Obj *outbuf = NULL;
+ Tcl_HashEntry *entry = NULL;
+
+ time_t ctime;
+ time_t mtime;
+
+ rivet_server_conf *rsc;
+ Tcl_Interp *interp = req->interp;
+
+ rsc = Rivet_GetConf( req->req );
+
+ /* If the user configuration has indeed been updated, I guess that
+ pretty much invalidates anything that might have been
+ cached. */
+
+ /* This is all horrendously slow, and means we should *also* be
+ doing caching on the modification time of the .htaccess files
+ that concern us. FIXME */
+
+ if (rsc->user_scripts_updated && *(rsc->cache_size) != 0) {
+ int ct;
+ Tcl_HashEntry *delEntry;
+ /* Clean out the list. */
+ ct = *(rsc->cache_free);
+ while (ct < *(rsc->cache_size)) {
+ /* Free the corresponding hash entry. */
+ delEntry = Tcl_FindHashEntry(
+ rsc->objCache,
+ rsc->objCacheList[ct]);
+ if (delEntry != NULL) {
+ Tcl_DecrRefCount((Tcl_Obj *)Tcl_GetHashValue(delEntry));
+ }
+ Tcl_DeleteHashEntry(delEntry);
+
+ free(rsc->objCacheList[ct]);
+ rsc->objCacheList[ct] = NULL;
+ ct ++;
+ }
+ *(rsc->cache_free) = *(rsc->cache_size);
}
- Tcl_DecrRefCount(arrayName);
- rivet_server_conf *rdc = RIVET_SERVER_CONF( r->per_dir_config );
+ /* If toplevel is 0, we are being called from Parse, which means
+ we need to get the information about the file ourselves. */
+ if (toplevel == 0)
+ {
+ Tcl_Obj *fnobj;
+ Tcl_StatBuf buf;
- if( rdc->rivet_before_script ) {
- Tcl_DecrRefCount( rdc->rivet_before_script );
+ fnobj = Tcl_NewStringObj(filename, -1);
+ Tcl_IncrRefCount(fnobj);
+ if( Tcl_FSStat(fnobj, &buf) < 0 )
+ return TCL_ERROR;
+ Tcl_DecrRefCount(fnobj);
+ ctime = buf.st_ctime;
+ mtime = buf.st_mtime;
+ } else {
+ ctime = req->req->finfo.ctime;
+ mtime = req->req->finfo.mtime;
}
- if( rdc->rivet_after_script ) {
- Tcl_DecrRefCount( rdc->rivet_after_script );
+
+ /* Look for the script's compiled version. If it's not found,
+ * create it.
+ */
+ if (*(rsc->cache_size))
+ {
+ hashKey = (char*) apr_psprintf(req->req->pool, "%s%lx%lx%d", filename,
+ mtime, ctime, toplevel);
+ entry = Tcl_CreateHashEntry(rsc->objCache, hashKey, &isNew);
}
- if( rdc->rivet_error_script ) {
- Tcl_DecrRefCount( rdc->rivet_error_script );
+
+ /* We don't have a compiled version. Let's create one. */
+ if (isNew || *(rsc->cache_size) == 0)
+ {
+ outbuf = Tcl_NewObj();
+ Tcl_IncrRefCount(outbuf);
+
+ if (toplevel) {
+ if (rsc->rivet_before_script) {
+ Tcl_AppendObjToObj(outbuf,rsc->rivet_before_script);
+ }
+ }
+
+/*
+ * We check whether we are dealing with a pure Tcl script or a Rivet template.
+ * Actually this check is done only if we are processing a toplevel file, every nested
+ * file (files included through the 'parse' command) is treated as a template.
+ */
+
+ if (!toplevel || (Rivet_CheckType(req->req) == RIVET_TEMPLATE))
+ {
+ /* toplevel == 0 means we are being called from the parse
+ * command, which only works on Rivet .rvt files. */
+
+ result = Rivet_GetRivetFile(filename, toplevel, outbuf, interp);
+
+ } else {
+ /* It's a plain Tcl file */
+ result = Rivet_GetTclFile(filename, outbuf, interp);
+ }
+
+ if (result != TCL_OK)
+ {
+ Tcl_DecrRefCount(outbuf);
+ return result;
+ }
+
+ if (toplevel && rsc->rivet_after_script) {
+ Tcl_AppendObjToObj(outbuf,rsc->rivet_after_script);
+ }
+
+ if (*(rsc->cache_size)) {
+ /* We need to incr the reference count of outbuf because we want
+ * it to outlive this function. This allows it to stay alive
+ * as long as it's in the object cache.
+ */
+ Tcl_IncrRefCount( outbuf );
+ Tcl_SetHashValue(entry, (ClientData)outbuf);
+ }
+
+ if (*(rsc->cache_free)) {
+
+ //hkCopy = (char*) malloc ((strlen(hashKey)+1) * sizeof(char));
+ //strcpy(rsc->objCacheList[-- *(rsc->cache_free)], hashKey);
+ rsc->objCacheList[--*(rsc->cache_free)] =
+ (char*) malloc ((strlen(hashKey)+1) * sizeof(char));
+ strcpy(rsc->objCacheList[*(rsc->cache_free)], hashKey);
+ //rsc->objCacheList[-- *(rsc->cache_free) ] = strdup(hashKey);
+ } else if (*(rsc->cache_size)) { /* If it's zero, we just skip this. */
+ Tcl_HashEntry *delEntry;
+ delEntry = Tcl_FindHashEntry(
+ rsc->objCache,
+ rsc->objCacheList[*(rsc->cache_size) - 1]);
+ Tcl_DecrRefCount((Tcl_Obj *)Tcl_GetHashValue(delEntry));
+ Tcl_DeleteHashEntry(delEntry);
+ free(rsc->objCacheList[*(rsc->cache_size) - 1]);
+ memmove((rsc->objCacheList) + 1, rsc->objCacheList,
+ sizeof(char *) * (*(rsc->cache_size) - 1));
+
+ //hkCopy = (char*) malloc ((strlen(hashKey)+1) * sizeof(char));
+ //strcpy (rsc->objCacheList[0], hashKey);
+ rsc->objCacheList[0] = (char*) malloc ((strlen(hashKey)+1) * sizeof(char));
+ strcpy (rsc->objCacheList[0], hashKey);
+
+ //rsc->objCacheList[0] = (char*) strdup(hashKey);
+ }
+ } else {
+ /* We found a compiled version of this page. */
+ outbuf = (Tcl_Obj *)Tcl_GetHashValue(entry);
+ Tcl_IncrRefCount(outbuf);
+ }
+
+ rsc->user_scripts_updated = 0;
+ {
+ int res = 0;
+ res = Rivet_ExecuteAndCheck(interp, outbuf, req->req);
+ Tcl_DecrRefCount(outbuf);
+ return res;
}
-#endif
}
+/*
+ * -- Rivet_ParseExecString
+ *
+ * This function accepts a Tcl_Obj carrying a string to be interpreted as
+ * a Rivet template. This function is the core for command 'parsestr'
+ *
+ * Arguments:
+ *
+ * - TclWebRequest* req: pointer to the structure collecting Tcl and
+ * Apache data
+ * - Tcl_Obj* inbuf: Tcl object storing the template to be parsed.
+ */
+
+int
+Rivet_ParseExecString (TclWebRequest* req, Tcl_Obj* inbuf)
+{
+ int res = 0;
+ Tcl_Obj* outbuf = Tcl_NewObj();
+ Tcl_Interp *interp = req->interp;
+
+ Tcl_IncrRefCount(outbuf);
+ Tcl_AppendToObj(outbuf, "puts -nonewline \"", -1);
+
+ /* If we are not inside a <? ?> section, add the closing ". */
+ if (Rivet_Parser(outbuf, inbuf) == 0)
+ {
+ Tcl_AppendToObj(outbuf, "\"\n", 2);
+ }
+
+ Tcl_AppendToObj(outbuf, "\n", -1);
+
+ res = Rivet_ExecuteAndCheck(interp, outbuf, req->req);
+ Tcl_DecrRefCount(outbuf);
+
+ return res;
+}
/*
*-----------------------------------------------------------------------------
@@ -277,7 +444,7 @@ Rivet_CleanupRequest( request_rec *r )
*
*-----------------------------------------------------------------------------
*/
-static void
+static void
Rivet_PerInterpInit(server_rec *s, rivet_server_conf *rsc, apr_pool_t *p)
{
Tcl_Interp *interp = rsc->server_interp;
@@ -380,15 +547,17 @@ Rivet_PerInterpInit(server_rec *s, rivet
Tcl_Release(interp);
}
+
static int
Rivet_InitHandler(apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp, server_rec *s)
{
rivet_server_conf *rsc = RIVET_SERVER_CONF( s->module_config );
- rivet_panic_pool = pPool;
- rivet_panic_server_rec = s;
rivet_module_globals = apr_palloc(pPool,sizeof(mod_rivet_globals));
rivet_module_globals->rsc_p = rsc;
+ rivet_module_globals->rivet_panic_pool = pPool;
+ rivet_module_globals->rivet_panic_server_rec = s;
+
#if RIVET_DISPLAY_VERSION
ap_add_version_component(pPool, RIVET_PACKAGE_NAME"/"RIVET_VERSION);
#else
@@ -446,48 +615,6 @@ Rivet_InitHandler(apr_pool_t *pPool, apr
return OK;
}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * Rivet_PanicProc --
- *
- * Called when Tcl panics, usually because of memory problems.
- * We log the request, in order to be able to determine what went
- * wrong later.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * Calls abort(), which does not return - the child exits.
- *
- *-----------------------------------------------------------------------------
- */
-static void
-Rivet_Panic TCL_VARARGS_DEF(CONST char *, arg1)
-{
- va_list argList;
- char *buf;
- char *format;
-
- format = (char *) TCL_VARARGS_START(char *,arg1,argList);
- buf = (char *) apr_pvsprintf(rivet_panic_pool, format, argList);
-
- if (rivet_panic_request_rec != NULL) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL,
- rivet_panic_server_rec,
- MODNAME ": Critical error in request: %s",
- rivet_panic_request_rec->unparsed_uri);
- }
-
- ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL,
- rivet_panic_server_rec, "%s", buf);
-
- abort();
-}
-
/*
*-----------------------------------------------------------------------------
* Rivet_CreateTclInterp --
@@ -502,7 +629,7 @@ Rivet_Panic TCL_VARARGS_DEF(CONST char *
*
*-----------------------------------------------------------------------------
*/
-static Tcl_Interp*
+static Tcl_Interp*
Rivet_CreateTclInterp (server_rec* s)
{
Tcl_Interp* interp;
@@ -532,56 +659,6 @@ Rivet_CreateTclInterp (server_rec* s)
/*
*-----------------------------------------------------------------------------
- * Rivet_CreateCache --
- *
- * Arguments:
- * rsc: pointer to a server_rec structure
- *
- * Results:
- * None
- *
- * Side Effects:
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-Rivet_CreateCache (server_rec *s, apr_pool_t *p)
-{
- extern int ap_max_requests_per_child;
- rivet_server_conf *rsc = RIVET_SERVER_CONF( s->module_config );
-
- /* If the user didn't set a cache size in their configuration, we
- * will assume an arbitrary size for them.
- *
- * If the cache size is 0, the user has requested not to cache
- * documents.
- */
-
- if(*(rsc->cache_size) < 0) {
- if (ap_max_requests_per_child != 0) {
- *(rsc->cache_size) = ap_max_requests_per_child / 5;
- } else {
- *(rsc->cache_size) = 50; // Arbitrary number
- }
- }
-
- if (*(rsc->cache_size) != 0) {
- *(rsc->cache_free) = *(rsc->cache_size);
- }
-
- // Initialize cache structures
-
- if (*(rsc->cache_size)) {
- rsc->objCacheList = apr_pcalloc(
- p, (signed)(*(rsc->cache_size) * sizeof(char *)));
- rsc->objCache = apr_pcalloc(p, sizeof(Tcl_HashTable));
- Tcl_InitHashTable(rsc->objCache, TCL_STRING_KEYS);
- }
-}
-
-/*
- *-----------------------------------------------------------------------------
*
* Rivet_InitTclStuff --
*
@@ -597,15 +674,15 @@ Rivet_CreateCache (server_rec *s, apr_po
*-----------------------------------------------------------------------------
*/
-static void
+static void
Rivet_InitTclStuff(server_rec *s, apr_pool_t *p)
{
rivet_server_conf *rsc = RIVET_SERVER_CONF( s->module_config );
Tcl_Interp *interp = rsc->server_interp;
rivet_server_conf *myrsc;
server_rec *sr;
- extern int ap_max_requests_per_child;
int interpCount = 0;
+ //extern int ap_max_requests_per_child;
/* This code is run once per child process. In a threaded Tcl builds the forking
* of a child process most likely has not preserved the thread where the Tcl
@@ -652,7 +729,8 @@ Rivet_InitTclStuff(server_rec *s, apr_po
/* This sets up slave interpreters for other virtual hosts. */
if (sr != s) /* not the first one */
{
- if (rsc->separate_virtual_interps != 0) {
+ if (rsc->separate_virtual_interps != 0)
+ {
char *slavename = (char*) apr_psprintf (p, "%s_%d_%d",
sr->server_hostname,
sr->port,
@@ -660,7 +738,8 @@ Rivet_InitTclStuff(server_rec *s, apr_po
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
MODNAME
-": Rivet_InitTclStuff: creating slave interpreter '%s', hostname '%s', port '%d', separate interpreters %d",
+ ": Rivet_InitTclStuff: creating slave interpreter '%s', "\
+ "hostname '%s', port '%d', separate interpreters %d",
slavename, sr->server_hostname, sr->port,
rsc->separate_virtual_interps);
@@ -704,7 +783,7 @@ Rivet_InitTclStuff(server_rec *s, apr_po
*
*-----------------------------------------------------------------------------
*/
-static void
+static void
Rivet_ChildHandlers(server_rec *s, int init)
{
server_rec *sr;
@@ -871,7 +950,7 @@ Rivet_SendContent(request_rec *r)
/* Set the global request req to know what we are dealing with in
* case we have to call the PanicProc. */
- rivet_panic_request_rec = r;
+ rivet_module_globals->rivet_panic_request_rec = r;
rsc = Rivet_GetConf(r);
rivet_module_globals->rsc_p = rsc;
Modified: tcl/rivet/trunk/src/apache-2/mod_rivet.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/mod_rivet.h?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/mod_rivet.h (original)
+++ tcl/rivet/trunk/src/apache-2/mod_rivet.h Sat Aug 9 15:29:07 2014
@@ -20,6 +20,11 @@
#ifndef MOD_RIVET_H
#define MOD_RIVET_H 1
+/* Rivet config */
+#ifdef HAVE_CONFIG_H
+#include <rivet_config.h>
+#endif
+
#include <httpd.h>
#include <tcl.h>
#include "apache_request.h"
@@ -119,7 +124,11 @@ typedef struct _rivet_interp_globals {
*/
typedef struct _mod_rivet_globals {
- rivet_server_conf* rsc_p;
+/* This is used *only* in the PanicProc. Otherwise, don't touch it! */
+ request_rec* rivet_panic_request_rec;
+ apr_pool_t* rivet_panic_pool;
+ server_rec* rivet_panic_server_rec;
+ rivet_server_conf* rsc_p;
} mod_rivet_globals;
rivet_server_conf *Rivet_GetConf(request_rec *r);
@@ -155,15 +164,20 @@ Tcl_Obj* Rivet_CurrentServerRec ( Tcl_
#define RIVET_TEMPLATE 1
#define RIVET_TCLFILE 2
-EXTERN int Rivet_chdir_file (const char *file);
-EXTERN int Rivet_CheckType (request_rec* r);
-EXTERN int Rivet_ExecuteAndCheck (Tcl_Interp *interp, Tcl_Obj *tcl_script_obj, request_rec *req);
-EXTERN int Rivet_ParseExecFile (TclWebRequest *req, char *filename, int toplevel);
-EXTERN int Rivet_ParseExecString (TclWebRequest* req, Tcl_Obj* inbuf);
+int Rivet_ParseExecFile (TclWebRequest *req, char *filename, int toplevel);
+int Rivet_ParseExecString (TclWebRequest* req, Tcl_Obj* inbuf);
/* error code set by command 'abort_page' */
#define ABORTPAGE_CODE "ABORTPAGE"
+/*
+ * for some reason the max buffer size definition is not exported by Tcl
+ * we steal and reproduce it here prepending the name with TCL
+ */
+
+#define TCL_MAX_CHANNEL_BUFFER_SIZE (1024*1024)
+#define MODNAME "mod_rivet"
+
#endif /* MOD_RIVET_H */
Modified: tcl/rivet/trunk/src/common/apache_config.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/common/apache_config.h?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/src/common/apache_config.h (original)
+++ tcl/rivet/trunk/src/common/apache_config.h Sat Aug 9 15:29:07 2014
@@ -1,25 +1,32 @@
/* apache_config.h -- configuration functions for apache 2.x */
-/* Copyright 2000-2005 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
/* $Id: apache_config.h 1547463 2013-12-03 16:35:08Z mxmanghi $ */
+
#ifndef __apache_config_h__
#define __apache_config_h__
+#include "mod_rivet.h"
+
void Rivet_CopyConfig( rivet_server_conf *oldrsc, rivet_server_conf *newrsc);
const char* Rivet_ServerConf(cmd_parms *cmd, void *dummy, const char *var, const char *val);
const char* Rivet_DirConf(cmd_parms *cmd, void *vrdc, const char *var, const char *val);
Modified: tcl/rivet/trunk/src/common/mod_rivet_common.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/common/mod_rivet_common.c?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/src/common/mod_rivet_common.c (original)
+++ tcl/rivet/trunk/src/common/mod_rivet_common.c Sat Aug 9 15:29:07 2014
@@ -1,29 +1,273 @@
-/* Copyright 2000-2014 The Apache Software Foundation
+/*
+ mod_rivet_common.c - functions likely to be shared among
+ different versions of mod_rivet.c
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
/* $Id: mod_rivet.c 1609472 2014-07-10 15:08:52Z mxmanghi $ */
#include <httpd.h>
#include <apr_strings.h>
+#include <ap_mpm.h>
/* as long as we need to emulate ap_chdir_file we need to include unistd.h */
#include <unistd.h>
#include "mod_rivet.h"
+#include "mod_rivet_common.h"
#include "TclWeb.h"
#include "rivetParser.h"
#include "rivet.h"
+#include "apache_config.h"
+
+extern mod_rivet_globals* module_globals;
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_PanicProc --
+ *
+ * Called when Tcl panics, usually because of memory problems.
+ * We log the request, in order to be able to determine what went
+ * wrong later.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Calls abort(), which does not return - the child exits.
+ *
+ *-----------------------------------------------------------------------------
+ */
+void Rivet_Panic TCL_VARARGS_DEF(CONST char *, arg1)
+{
+ va_list argList;
+ char *buf;
+ char *format;
+
+ format = (char *) TCL_VARARGS_START(char *,arg1,argList);
+ buf = (char *) apr_pvsprintf(module_globals->rivet_panic_pool, format, argList);
+
+ if (module_globals->rivet_panic_request_rec != NULL) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL,
+ module_globals->rivet_panic_server_rec,
+ MODNAME ": Critical error in request: %s",
+ module_globals->rivet_panic_request_rec->unparsed_uri);
+ }
+
+ ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL,
+ module_globals->rivet_panic_server_rec, "%s", buf);
+
+ abort();
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Rivet_CreateCache --
+ *
+ * Arguments:
+ * rsc: pointer to a server_rec structure
+ *
+ * Results:
+ * None
+ *
+ * Side Effects:
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void Rivet_CreateCache (server_rec *s, apr_pool_t *p)
+{
+ extern int ap_max_requests_per_child;
+ rivet_server_conf *rsc = RIVET_SERVER_CONF( s->module_config );
+
+ /* If the user didn't set a cache size in their configuration, we
+ * will assume an arbitrary size for them.
+ *
+ * If the cache size is 0, the user has requested not to cache
+ * documents.
+ */
+
+ if(*(rsc->cache_size) < 0) {
+ if (ap_max_requests_per_child != 0) {
+ *(rsc->cache_size) = ap_max_requests_per_child / 5;
+ } else {
+ *(rsc->cache_size) = 50; // Arbitrary number
+ }
+ }
+
+ if (*(rsc->cache_size) != 0) {
+ *(rsc->cache_free) = *(rsc->cache_size);
+ }
+
+ // Initialize cache structures
+
+ if (*(rsc->cache_size)) {
+ rsc->objCacheList = apr_pcalloc(p, (signed)(*(rsc->cache_size)*sizeof(char *)));
+ rsc->objCache = apr_pcalloc(p, sizeof(Tcl_HashTable));
+ Tcl_InitHashTable(rsc->objCache, TCL_STRING_KEYS);
+ }
+}
+
+/*
+ * -- Rivet_CleanupRequest
+ *
+ * This function contained some come that cleaned up
+ * the user configuration before finishing a request
+ * processing. That code had been disabled and it's now
+ * removed, but we leave the function as a placeholder
+ * in case we want to stick into it something to do.
+ *
+ * Arguments:
+ *
+ * request_rec* request object pointer
+ *
+ * Returned value:
+ *
+ * None
+ */
+
+void Rivet_CleanupRequest( request_rec *r )
+{
+}
+
+/*
+ * -- Rivet_InitServerVariables
+ *
+ * Setup an array in each interpreter to tell us things about Apache.
+ * This saves us from having to do any real call to load an entire
+ * environment. This routine only gets called once, when the child process
+ * is created.
+ *
+ * Arguments:
+ *
+ * Tcl_Interp* interp: pointer to the Tcl interpreter
+ * apr_pool_t* pool: pool used for calling Apache framework functions
+ *
+ * Returned value:
+ * none
+ *
+ * Side effects:
+ *
+ * within the global scope of the interpreter passed as first
+ * argument a 'server' array is created and the variable associated
+ * to the following keys are defined
+ *
+ * SERVER_ROOT - Apache's root location
+ * SERVER_CONF - Apache's configuration file
+ * RIVET_DIR - Rivet's Tcl source directory
+ * RIVET_INIT - Rivet's init.tcl file
+ * RIVET_VERSION - Rivet version (only when RIVET_DISPLAY_VERSION is 1)
+ * MPM_THREADED - It should contain the string 'unsupported' for a prefork MPM
+ * MPM_FORKED - String describing the forking model of the MPM
+ *
+ */
+
+void Rivet_InitServerVariables( Tcl_Interp *interp, apr_pool_t *pool )
+{
+ int ap_mpm_result;
+ Tcl_Obj *obj;
+
+ obj = Tcl_NewStringObj(ap_server_root, -1);
+ Tcl_IncrRefCount(obj);
+ Tcl_SetVar2Ex(interp,
+ "server",
+ "SERVER_ROOT",
+ obj,
+ TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(obj);
+
+ obj = Tcl_NewStringObj(ap_server_root_relative(pool,SERVER_CONFIG_FILE), -1);
+ Tcl_IncrRefCount(obj);
+ Tcl_SetVar2Ex(interp,
+ "server",
+ "SERVER_CONF",
+ obj,
+ TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(obj);
+
+ obj = Tcl_NewStringObj(ap_server_root_relative(pool, RIVET_DIR), -1);
+ Tcl_IncrRefCount(obj);
+ Tcl_SetVar2Ex(interp,
+ "server",
+ "RIVET_DIR",
+ obj,
+ TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(obj);
+
+ obj = Tcl_NewStringObj(ap_server_root_relative(pool, RIVET_INIT), -1);
+ Tcl_IncrRefCount(obj);
+ Tcl_SetVar2Ex(interp,
+ "server",
+ "RIVET_INIT",
+ obj,
+ TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(obj);
+
+#if RIVET_DISPLAY_VERSION
+ obj = Tcl_NewStringObj(RIVET_VERSION, -1);
+ Tcl_IncrRefCount(obj);
+ Tcl_SetVar2Ex(interp,
+ "server",
+ "RIVET_VERSION",
+ obj,
+ TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(obj);
+#endif
+
+ if (ap_mpm_query(AP_MPMQ_IS_THREADED,&ap_mpm_result) == APR_SUCCESS)
+ {
+ switch (ap_mpm_result)
+ {
+ case AP_MPMQ_STATIC:
+ obj = Tcl_NewStringObj("static", -1);
+ break;
+ case AP_MPMQ_NOT_SUPPORTED:
+ obj = Tcl_NewStringObj("unsupported", -1);
+ break;
+ default:
+ obj = Tcl_NewStringObj("undefined", -1);
+ break;
+ }
+ Tcl_IncrRefCount(obj);
+ Tcl_SetVar2Ex(interp,"server","MPM_THREADED",obj,TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(obj);
+ }
+
+ if (ap_mpm_query(AP_MPMQ_IS_FORKED,&ap_mpm_result) == APR_SUCCESS)
+ {
+ switch (ap_mpm_result)
+ {
+ case AP_MPMQ_STATIC:
+ obj = Tcl_NewStringObj("static", -1);
+ break;
+ case AP_MPMQ_DYNAMIC:
+ obj = Tcl_NewStringObj("dynamic", -1);
+ break;
+ default:
+ obj = Tcl_NewStringObj("undefined", -1);
+ break;
+ }
+ Tcl_IncrRefCount(obj);
+ Tcl_SetVar2Ex(interp,"server","MPM_FORKED",obj,TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(obj);
+ }
+}
/*
* -- Rivet_chdir_file (const char* filename)
@@ -96,353 +340,4 @@ Rivet_CheckType (request_rec *req)
return ctype;
}
-/* -- Rivet_ExecuteAndCheck
- *
- * Tcl script execution central procedure. The script stored
- * outbuf is evaluated and in case an error occurs in the execution
- * an error handler is executed. In case the error code returned
- * is RIVET then the error was caused by the invocation of a
- * abort_page command and the script stored in conf->abort_script
- * is run istead. The default error script prints the error buffer
- *
- * Arguments:
- *
- * - Tcl_Interp* interp: the Tcl interpreter
- * - Tcl_Obj* tcl_script_obj: a pointer to the Tcl_Obj holding the script
- * - request_rec* req: the current request_rec object pointer
- *
- * Returned value:
- *
- * - invariably TCL_OK
- *
- * Side effects:
- *
- * The Tcl interpreter internal status is changed by the execution
- * of the script
- *
- */
-
-int
-Rivet_ExecuteAndCheck(Tcl_Interp *interp, Tcl_Obj *tcl_script_obj, request_rec *req)
-{
- rivet_server_conf *conf = Rivet_GetConf(req);
- rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL);
-
- Tcl_Preserve (interp);
- if ( Tcl_EvalObjEx(interp, tcl_script_obj, 0) == TCL_ERROR ) {
- Tcl_Obj *errscript;
- Tcl_Obj *errorCodeListObj;
- Tcl_Obj *errorCodeElementObj;
- char *errorCodeSubString;
-
- /* There was an error, see if it's from Rivet and it was caused
- * by abort_page.
- */
-
- errorCodeListObj = Tcl_GetVar2Ex (interp, "errorCode", (char *)NULL, TCL_GLOBAL_ONLY);
-
- /* errorCode is guaranteed to be set to NONE, but let's make sure
- * anyway rather than causing a SIGSEGV
- */
- ap_assert (errorCodeListObj != (Tcl_Obj *)NULL);
-
- /* dig the first element out of the errorCode list and see if it
- * says Rivet -- this shouldn't fail either, but let's assert
- * success so we don't get a SIGSEGV afterwards */
- ap_assert (Tcl_ListObjIndex (interp, errorCodeListObj, 0, &errorCodeElementObj) == TCL_OK);
-
- /* if the error was thrown by Rivet, see if it's abort_page and,
- * if so, don't treat it as an error, i.e. don't execute the
- * installed error handler or the default one, just check if
- * a rivet_abort_script is defined, otherwise the page emits
- * as normal
- */
- if (strcmp (Tcl_GetString (errorCodeElementObj), "RIVET") == 0) {
-
- /* dig the second element out of the errorCode list, make sure
- * it succeeds -- it should always
- */
- ap_assert (Tcl_ListObjIndex (interp, errorCodeListObj, 1, &errorCodeElementObj) == TCL_OK);
-
- errorCodeSubString = Tcl_GetString (errorCodeElementObj);
- if (strcmp (errorCodeSubString, ABORTPAGE_CODE) == 0)
- {
- if (conf->rivet_abort_script)
- {
- if (Tcl_EvalObjEx(interp,conf->rivet_abort_script,0) == TCL_ERROR)
- {
- CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 );
- TclWeb_PrintError("<b>Rivet AbortScript failed!</b>",1,globals->req);
- TclWeb_PrintError( errorinfo, 0, globals->req );
- }
- }
- goto good;
- }
- }
-
- Tcl_SetVar( interp, "errorOutbuf",Tcl_GetStringFromObj( tcl_script_obj, NULL ),TCL_GLOBAL_ONLY );
-
- /* If we don't have an error script, use the default error handler. */
- if (conf->rivet_error_script ) {
- errscript = conf->rivet_error_script;
- } else {
- errscript = conf->rivet_default_error_script;
- }
-
- Tcl_IncrRefCount(errscript);
- if (Tcl_EvalObjEx(interp, errscript, 0) == TCL_ERROR) {
- CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 );
- TclWeb_PrintError("<b>Rivet ErrorScript failed!</b>",1,globals->req);
- TclWeb_PrintError( errorinfo, 0, globals->req );
- }
-
- /* This shouldn't make the default_error_script go away,
- * because it gets a Tcl_IncrRefCount when it is created. */
- Tcl_DecrRefCount(errscript);
- }
-
- /* Make sure to flush the output if buffer_add was the only output */
-good:
-
- if (conf->after_every_script) {
- if (Tcl_EvalObjEx(interp,conf->after_every_script,0) == TCL_ERROR)
- {
- CONST84 char *errorinfo = Tcl_GetVar( interp, "errorInfo", 0 );
- TclWeb_PrintError("<b>Rivet AfterEveryScript failed!</b>",1,globals->req);
- TclWeb_PrintError( errorinfo, 0, globals->req );
- }
- }
-
- if (!globals->req->headers_set && (globals->req->charset != NULL)) {
- TclWeb_SetHeaderType (apr_pstrcat(globals->req->req->pool,"text/html;",globals->req->charset,NULL),globals->req);
- }
- TclWeb_PrintHeaders(globals->req);
- Tcl_Flush(*(conf->outchannel));
- Tcl_Release(interp);
-
- return TCL_OK;
-}
-
-/*
- * -- Rivet_ParseExecFile
- *
- * given a filename if the file exists it's either parsed (when a rivet
- * template) and then executed as a Tcl_Obj instance or directly executed
- * if a Tcl script.
- *
- * This is a separate function so that it may be called from command 'parse'
- *
- * Arguments:
- *
- * - TclWebRequest: pointer to the structure collecting Tcl and Apache data
- * - filename: pointer to a string storing the path to the template or
- * Tcl script
- * - toplevel: integer to be interpreted as a boolean meaning the
- * file is pointed by the request. When 0 that's a subtemplate
- * to be parsed and executed from another template
- */
-
-int
-Rivet_ParseExecFile(TclWebRequest *req, char *filename, int toplevel)
-{
- char *hashKey = NULL;
- int isNew = 0;
- int result = 0;
-
- Tcl_Obj *outbuf = NULL;
- Tcl_HashEntry *entry = NULL;
-
- time_t ctime;
- time_t mtime;
-
- rivet_server_conf *rsc;
- Tcl_Interp *interp = req->interp;
-
- rsc = Rivet_GetConf( req->req );
-
- /* If the user configuration has indeed been updated, I guess that
- pretty much invalidates anything that might have been
- cached. */
-
- /* This is all horrendously slow, and means we should *also* be
- doing caching on the modification time of the .htaccess files
- that concern us. FIXME */
-
- if (rsc->user_scripts_updated && *(rsc->cache_size) != 0) {
- int ct;
- Tcl_HashEntry *delEntry;
- /* Clean out the list. */
- ct = *(rsc->cache_free);
- while (ct < *(rsc->cache_size)) {
- /* Free the corresponding hash entry. */
- delEntry = Tcl_FindHashEntry(
- rsc->objCache,
- rsc->objCacheList[ct]);
- if (delEntry != NULL) {
- Tcl_DecrRefCount((Tcl_Obj *)Tcl_GetHashValue(delEntry));
- }
- Tcl_DeleteHashEntry(delEntry);
-
- free(rsc->objCacheList[ct]);
- rsc->objCacheList[ct] = NULL;
- ct ++;
- }
- *(rsc->cache_free) = *(rsc->cache_size);
- }
-
- /* If toplevel is 0, we are being called from Parse, which means
- we need to get the information about the file ourselves. */
- if (toplevel == 0)
- {
- Tcl_Obj *fnobj;
- Tcl_StatBuf buf;
-
- fnobj = Tcl_NewStringObj(filename, -1);
- Tcl_IncrRefCount(fnobj);
- if( Tcl_FSStat(fnobj, &buf) < 0 )
- return TCL_ERROR;
- Tcl_DecrRefCount(fnobj);
- ctime = buf.st_ctime;
- mtime = buf.st_mtime;
- } else {
- ctime = req->req->finfo.ctime;
- mtime = req->req->finfo.mtime;
- }
-
- /* Look for the script's compiled version. If it's not found,
- * create it.
- */
- if (*(rsc->cache_size))
- {
- hashKey = (char*) apr_psprintf(req->req->pool, "%s%lx%lx%d", filename,
- mtime, ctime, toplevel);
- entry = Tcl_CreateHashEntry(rsc->objCache, hashKey, &isNew);
- }
-
- /* We don't have a compiled version. Let's create one. */
- if (isNew || *(rsc->cache_size) == 0)
- {
- outbuf = Tcl_NewObj();
- Tcl_IncrRefCount(outbuf);
-
- if (toplevel) {
- if (rsc->rivet_before_script) {
- Tcl_AppendObjToObj(outbuf,rsc->rivet_before_script);
- }
- }
-
-/*
- * We check whether we are dealing with a pure Tcl script or a Rivet template.
- * Actually this check is done only if we are processing a toplevel file, every nested
- * file (files included through the 'parse' command) is treated as a template.
- */
-
- if (!toplevel || (Rivet_CheckType(req->req) == RIVET_TEMPLATE))
- {
- /* toplevel == 0 means we are being called from the parse
- * command, which only works on Rivet .rvt files. */
-
- result = Rivet_GetRivetFile(filename, toplevel, outbuf, interp);
-
- } else {
- /* It's a plain Tcl file */
- result = Rivet_GetTclFile(filename, outbuf, interp);
- }
-
- if (result != TCL_OK)
- {
- Tcl_DecrRefCount(outbuf);
- return result;
- }
-
- if (toplevel && rsc->rivet_after_script) {
- Tcl_AppendObjToObj(outbuf,rsc->rivet_after_script);
- }
-
- if (*(rsc->cache_size)) {
- /* We need to incr the reference count of outbuf because we want
- * it to outlive this function. This allows it to stay alive
- * as long as it's in the object cache.
- */
- Tcl_IncrRefCount( outbuf );
- Tcl_SetHashValue(entry, (ClientData)outbuf);
- }
-
- if (*(rsc->cache_free)) {
-
- //hkCopy = (char*) malloc ((strlen(hashKey)+1) * sizeof(char));
- //strcpy(rsc->objCacheList[-- *(rsc->cache_free)], hashKey);
- rsc->objCacheList[--*(rsc->cache_free)] =
- (char*) malloc ((strlen(hashKey)+1) * sizeof(char));
- strcpy(rsc->objCacheList[*(rsc->cache_free)], hashKey);
- //rsc->objCacheList[-- *(rsc->cache_free) ] = strdup(hashKey);
- } else if (*(rsc->cache_size)) { /* If it's zero, we just skip this. */
- Tcl_HashEntry *delEntry;
- delEntry = Tcl_FindHashEntry(
- rsc->objCache,
- rsc->objCacheList[*(rsc->cache_size) - 1]);
- Tcl_DecrRefCount((Tcl_Obj *)Tcl_GetHashValue(delEntry));
- Tcl_DeleteHashEntry(delEntry);
- free(rsc->objCacheList[*(rsc->cache_size) - 1]);
- memmove((rsc->objCacheList) + 1, rsc->objCacheList,
- sizeof(char *) * (*(rsc->cache_size) - 1));
-
- //hkCopy = (char*) malloc ((strlen(hashKey)+1) * sizeof(char));
- //strcpy (rsc->objCacheList[0], hashKey);
- rsc->objCacheList[0] = (char*) malloc ((strlen(hashKey)+1) * sizeof(char));
- strcpy (rsc->objCacheList[0], hashKey);
-
- //rsc->objCacheList[0] = (char*) strdup(hashKey);
- }
- } else {
- /* We found a compiled version of this page. */
- outbuf = (Tcl_Obj *)Tcl_GetHashValue(entry);
- Tcl_IncrRefCount(outbuf);
- }
-
- rsc->user_scripts_updated = 0;
- {
- int res = 0;
- res = Rivet_ExecuteAndCheck(interp, outbuf, req->req);
- Tcl_DecrRefCount(outbuf);
- return res;
- }
-}
-
-/*
- * -- Rivet_ParseExecString
- *
- * This function accepts a Tcl_Obj carrying a string to be interpreted as
- * a Rivet template. This function is the core for command 'parsestr'
- *
- * Arguments:
- *
- * - TclWebRequest* req: pointer to the structure collecting Tcl and
- * Apache data
- * - Tcl_Obj* inbuf: Tcl object storing the template to be parsed.
- */
-
-int
-Rivet_ParseExecString (TclWebRequest* req, Tcl_Obj* inbuf)
-{
- int res = 0;
- Tcl_Obj* outbuf = Tcl_NewObj();
- Tcl_Interp *interp = req->interp;
-
- Tcl_IncrRefCount(outbuf);
- Tcl_AppendToObj(outbuf, "puts -nonewline \"", -1);
-
- /* If we are not inside a <? ?> section, add the closing ". */
- if (Rivet_Parser(outbuf, inbuf) == 0)
- {
- Tcl_AppendToObj(outbuf, "\"\n", 2);
- }
-
- Tcl_AppendToObj(outbuf, "\n", -1);
-
- res = Rivet_ExecuteAndCheck(interp, outbuf, req->req);
- Tcl_DecrRefCount(outbuf);
-
- return res;
-}
Added: tcl/rivet/trunk/src/common/mod_rivet_common.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/common/mod_rivet_common.h?rev=1616967&view=auto
==============================================================================
--- tcl/rivet/trunk/src/common/mod_rivet_common.h (added)
+++ tcl/rivet/trunk/src/common/mod_rivet_common.h Sat Aug 9 15:29:07 2014
@@ -0,0 +1,31 @@
+
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+#ifndef _MOD_RIVET_COMMON_
+#define _MOD_RIVET_COMMON_
+
+EXTERN int Rivet_chdir_file (const char *file);
+EXTERN int Rivet_CheckType (request_rec* r);
+EXTERN void Rivet_CleanupRequest(request_rec *r);
+EXTERN void Rivet_InitServerVariables(Tcl_Interp *interp, apr_pool_t *pool);
+EXTERN void Rivet_CreateCache (server_rec *s, apr_pool_t *p);
+EXTERN void Rivet_Panic TCL_VARARGS_DEF(CONST char *, arg1);
+
+#endif
Modified: tcl/rivet/trunk/src/experimental/Makefile.am
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/Makefile.am?rev=1616967&r1=1616966&r2=1616967&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/Makefile.am (original)
+++ tcl/rivet/trunk/src/experimental/Makefile.am Sat Aug 9 15:29:07 2014
@@ -20,13 +20,19 @@ mod_rivet_la_SOURCES = mod_rivet.c
mod_rivet_la_LDFLAGS = @TCL_LIB_SPEC@ @APXS_LDFLAGS@ @APR_LDFLAGS@ -module -avoid-version
mod_rivet_la_LIBADD = @TCL_LIBS@ @APXS_LIBS@
-mod_rivet_la_CPPFLAGS = -I@rivet_core@ -I@rivet_channel@ -I@RIVET_BASE_INCLUDE@/common -I@RIVET_BASE_INCLUDE@/parser -I../@apache_request@ @apache_include@ -I@RIVET_BASE_INCLUDE@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_CPPFLAGS@ @APR_INCLUDES@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"'
+mod_rivet_la_CPPFLAGS = -I../@rivet_core@ -I../@rivet_channel@ -I@RIVET_BASE_INCLUDE@/common -I@RIVET_BASE_INCLUDE@/parser -I../@apache_request@ @apache_include@ -I@RIVET_BASE_INCLUDE@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_CPPFLAGS@ @APR_INCLUDES@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"'
-lib_libexecdir = @RIVET_TCL_TARGET@
-lib_libexec_LTLIBRARIES = rivet_worker_mpm.la
+lib_libexecdir = @RIVET_TCL_TARGET@/mpm
+lib_libexec_LTLIBRARIES = rivet_worker_mpm.la rivet_prefork_mpm.la
rivet_worker_mpm_la_SOURCES = rivet_worker_mpm.c
rivet_worker_mpm_la_LDFLAGS = @TCL_STUB_LIB_SPEC@ @APXS_LDFLAGS@ -module -avoid-version
rivet_worker_mpm_la_LIBADD = @APXS_LIBS@
rivet_worker_mpm_la_CPPFLAGS = @apache_include@ -I@rivet_core@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_CPPFLAGS@ @APR_INCLUDES@ -I../@apache_request@ -I@RIVET_BASE_INCLUDE@/common -I@RIVET_BASE_INCLUDE@
+rivet_prefork_mpm_la_SOURCES = rivet_prefork_mpm.c
+rivet_prefork_mpm_la_LDFLAGS = @TCL_STUB_LIB_SPEC@ @APXS_LDFLAGS@ -module -avoid-version
+rivet_prefork_mpm_la_LIBADD = @APXS_LIBS@
+rivet_prefork_mpm_la_CPPFLAGS = @apache_include@ -I@rivet_core@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_CPPFLAGS@ @APR_INCLUDES@ -I../@apache_request@ -I@RIVET_BASE_INCLUDE@/common -I@RIVET_BASE_INCLUDE@
+
+
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org