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 2016/11/04 01:03:32 UTC
svn commit: r1767983 - in /tcl/rivet/trunk: ./ doc/xml/ rivet/ src/
src/mod_rivet/ src/mod_rivet_ng/
Author: mxmanghi
Date: Fri Nov 4 01:03:32 2016
New Revision: 1767983
URL: http://svn.apache.org/viewvc?rev=1767983&view=rev
Log:
* src/mod_rivet/mod_rivet_cache.[c|h]: new file
for the cache code created to have uniform file structure
in order to build the module
* src/mod_rivet_ng/mod_rivet_cache.c: completed code for cache management
* src/mod_rivet_ng/rivetCore.c: new command ::rivet::url_script
returns the full URL referenced script to be parsed
subsequently
* src/mod_rivet/mod_rivet_generator.c: we are now
calling the cache routines, but it won't be needed any longer
as the cache control and interaction are devolved to
the parse routines
Added:
tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.c
tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.h
tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.c
tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.h
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/doc/xml/formbroker.xml
tcl/rivet/trunk/rivet/init.tcl
tcl/rivet/trunk/rivet/init.tcl.in
tcl/rivet/trunk/src/Makefile.am
tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.c
tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.h
tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c
tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c
tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h
tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c
tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.h
tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.c
tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.h
tcl/rivet/trunk/src/mod_rivet_ng/rivetCore.c
tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c
tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c
tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Fri Nov 4 01:03:32 2016
@@ -1,3 +1,16 @@
+2016-11-03 Massimo Manghi <mx...@apache.org>
+ * src/mod_rivet/mod_rivet_cache.[c|h]: new file
+ for the cache code created to have uniform file structure
+ in order to build the module
+ * src/mod_rivet_ng/mod_rivet_cache.c: completed code for cache management
+ * src/mod_rivet_ng/rivetCore.c: new command ::rivet::url_script
+ returns the full URL referenced script to be parsed
+ subsequently
+ * src/mod_rivet/mod_rivet_generator.c: we are now
+ calling the cache routines, but it won't be needed any longer
+ as the cache control and interaction are devolved to
+ the parse routines
+
2016-10-28 Massimo Manghi <mx...@apache.org>
* src/mod_rivet/[lazy|worker|prefork]_mpm_bridge.c: new
Rivet_ExecutionThreadInit unifies thread initialization
Modified: tcl/rivet/trunk/doc/xml/formbroker.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/doc/xml/formbroker.xml?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/doc/xml/formbroker.xml (original)
+++ tcl/rivet/trunk/doc/xml/formbroker.xml Fri Nov 4 01:03:32 2016
@@ -1,10 +1,19 @@
<section id="formbroker">
<title>The Form Broker</title>
<section>
- <title>Introduction</title>
- <para>
- ....
- </para>
+ <title>Introduction</title>
+ <para>
+ The <command>FormBroker</command> package creates instances of
+ <command>FormBroker</command> controlled objects each representing
+ a form data description. These objects expose a simple set of methods
+ meant to validate and control data typically posted through an HTML form,
+ thus data represented the association of form variables with their values as
+ returned by the <command>::rivet::load_response</command> command
+ </para>
+ <para>
+ The <command>FormBroker</command> creates new instances
+
+
</section>
<refentry id="fb">
</refentry>
Modified: tcl/rivet/trunk/rivet/init.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/init.tcl?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/init.tcl (original)
+++ tcl/rivet/trunk/rivet/init.tcl Fri Nov 4 01:03:32 2016
@@ -102,6 +102,25 @@ namespace eval ::Rivet {
}
###
+ ## -- Default request processing
+ ##
+ ## a request will handled by this procedure
+
+ proc request_handling {} {
+ ::try {
+ #<content-generation-script>
+ } trap {RIVET ABORTPAGE} {
+ #<abort-script>
+ } trap {RIVET THREAD_EXIT} {
+ #<sudden-exit-script>
+ } on error {::rivet::error_code ::rivet::error_options} {
+ #<error-script>
+ } finally {
+ #<after-every-script>
+ }
+ }
+
+ ###
## The main initialization procedure for Rivet.
###
proc init {} {
Modified: tcl/rivet/trunk/rivet/init.tcl.in
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/init.tcl.in?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/init.tcl.in (original)
+++ tcl/rivet/trunk/rivet/init.tcl.in Fri Nov 4 01:03:32 2016
@@ -102,6 +102,25 @@ namespace eval ::Rivet {
}
###
+ ## -- Default request processing
+ ##
+ ## a request will handled by this procedure
+
+ proc request_handling {} {
+ ::try {
+ #<content-generation-script>
+ } trap {RIVET ABORTPAGE} {
+ #<abort-script>
+ } trap {RIVET THREAD_EXIT} {
+ #<sudden-exit-script>
+ } on error {::rivet::error_code ::rivet::error_options} {
+ #<error-script>
+ } finally {
+ #<after-every-script>
+ }
+ }
+
+ ###
## The main initialization procedure for Rivet.
###
proc init {} {
Modified: tcl/rivet/trunk/src/Makefile.am
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/Makefile.am?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/Makefile.am (original)
+++ tcl/rivet/trunk/src/Makefile.am Fri Nov 4 01:03:32 2016
@@ -48,7 +48,8 @@ mod_rivet_la_SOURCES = @rivet_core@/mod
@rivet_core@/TclWebapache.c \
@rivet_core@/apache_config.c \
@rivet_core@/mod_rivet_common.c \
- @rivet_core@/mod_rivet_generator.c
+ @rivet_core@/mod_rivet_generator.c \
+ @rivet_core@/mod_rivet_cache.c
mod_rivet_la_LDFLAGS = @TCL_LIB_SPEC@ @APXS_LDFLAGS@ @APR_LDFLAGS@ -module -avoid-version
mod_rivet_la_LIBADD = @TCL_LIBS@ @APXS_LIBS@
Added: tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.c?rev=1767983&view=auto
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.c (added)
+++ tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.c Fri Nov 4 01:03:32 2016
@@ -0,0 +1,49 @@
+/* -- mod_rivet_cache.c */
+/*
+ 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_common.c 1767022 2016-10-28 13:27:18Z mxmanghi $ */
+
+#include <apr_pools.h>
+#include "mod_rivet.h"
+
+/*
+ * -- Rivet_CreateCache
+ *
+ * Creates a per interpreter script cach
+ *
+ * Arguments:
+ * apr_pool_t *p - APR memory pool pointer,
+ * rivet_thread_interp* interp_obj - interpreter object
+ *
+ *
+ * Results:
+ * None
+ *
+ * Side Effects:
+ *
+ */
+
+void Rivet_CreateCache (apr_pool_t *p, rivet_thread_interp* interp_obj)
+{
+ interp_obj->objCacheList = apr_pcalloc(p,(signed)((interp_obj->cache_size)*sizeof(char *)));
+ interp_obj->objCache = apr_pcalloc(p,sizeof(Tcl_HashTable));
+ Tcl_InitHashTable(interp_obj->objCache,TCL_STRING_KEYS);
+}
+
Added: tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.h?rev=1767983&view=auto
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.h (added)
+++ tcl/rivet/trunk/src/mod_rivet/mod_rivet_cache.h Fri Nov 4 01:03:32 2016
@@ -0,0 +1,29 @@
+/* mod_rivet_cache.h -- The mod_rivet cache */
+/*
+ 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: $ */
+
+#ifndef __mod_rivet_cache__
+#define __mod_rivet_cache__
+
+EXTERN void Rivet_CreateCache (apr_pool_t *p, rivet_thread_interp* interp_obj);
+// EXTERN void Rivet_CacheCleanup (rivet_thread_private* private,rivet_thread_interp* rivet_interp);
+
+#endif /* mod_rivet_cache.h */
Modified: tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.c (original)
+++ tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.c Fri Nov 4 01:03:32 2016
@@ -217,30 +217,6 @@ void Rivet_PerInterpInit(rivet_thread_in
interp_obj->flags |= RIVET_INTERP_INITIALIZED;
}
-/*
- * -- Rivet_CreateCache
- *
- * Creates a per interpreter script cach
- *
- * Arguments:
- * apr_pool_t *p - APR memory pool pointer,
- * rivet_thread_interp* interp_obj - interpreter object
- *
- *
- * Results:
- * None
- *
- * Side Effects:
- *
- */
-
-void Rivet_CreateCache (apr_pool_t *p, rivet_thread_interp* interp_obj)
-{
- interp_obj->objCacheList = apr_pcalloc(p,(signed)((interp_obj->cache_size)*sizeof(char *)));
- interp_obj->objCache = apr_pcalloc(p,sizeof(Tcl_HashTable));
- Tcl_InitHashTable(interp_obj->objCache,TCL_STRING_KEYS);
-}
-
/* -- Rivet_NewVHostInterp
*
* Returns a new rivet_thread_interp object with a new Tcl interpreter
Modified: tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.h?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.h (original)
+++ tcl/rivet/trunk/src/mod_rivet/mod_rivet_common.h Fri Nov 4 01:03:32 2016
@@ -23,7 +23,6 @@
#define _MOD_RIVET_COMMON_
EXTERN running_scripts* Rivet_RunningScripts (apr_pool_t* pool,running_scripts* scripts,rivet_server_conf* rivet_conf);
EXTERN void Rivet_PerInterpInit(rivet_thread_interp* interp_obj,rivet_thread_private* private, server_rec *s, apr_pool_t *p);
-EXTERN void Rivet_CreateCache (apr_pool_t *p, rivet_thread_interp* interp_obj);
EXTERN rivet_thread_interp* Rivet_NewVHostInterp(apr_pool_t *pool,server_rec* s);
EXTERN void Rivet_ProcessorCleanup (void *data);
EXTERN int Rivet_chdir_file (const char *file);
@@ -36,5 +35,5 @@ EXTERN rivet_thread_private* Rivet_Creat
EXTERN rivet_thread_private* Rivet_ExecutionThreadInit (void);
EXTERN rivet_thread_private* Rivet_SetupTclPanicProc (void);
EXTERN void Rivet_ReleaseRivetChannel (Tcl_Interp* interp, Tcl_Channel* channel);
-
+EXTERN void Rivet_CreateCache (apr_pool_t *p, rivet_thread_interp* interp_obj);
#endif
Modified: tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c Fri Nov 4 01:03:32 2016
@@ -531,7 +531,6 @@ TclWeb_GetEnvVars(Tcl_Obj *envvar,rivet_
Tcl_Obj *val;
TclWebRequest *req;
-
TclWeb_InitEnvVars(private);
req = private->req;
@@ -541,27 +540,27 @@ TclWeb_GetEnvVars(Tcl_Obj *envvar,rivet_
env = (apr_table_entry_t *) env_arr->elts;
for (i = 0; i < env_arr->nelts; ++i)
{
- if ((!env[i].key) || (!env[i].val)) {
- continue;
- }
-
- key = TclWeb_StringToUtfToObj(env[i].key, req);
- val = TclWeb_StringToUtfToObj(env[i].val, req);
- Tcl_IncrRefCount(key);
- Tcl_IncrRefCount(val);
-
- /* Variable scope resolution changed to default (flags: 0)
- * to enable creation of the array in the caller's local scope.
- * Default behavior (creation in the ::request namespace)
- * is now more consistently constrained by fully qualifying
- * the default array names (see rivetCore.c). This should fix
- * Bug 48963
- */
+ if ((!env[i].key) || (!env[i].val)) {
+ continue;
+ }
+
+ key = TclWeb_StringToUtfToObj(env[i].key, req);
+ val = TclWeb_StringToUtfToObj(env[i].val, req);
+ Tcl_IncrRefCount(key);
+ Tcl_IncrRefCount(val);
+
+ /* Variable scope resolution changed to default (flags: 0)
+ * to enable creation of the array in the caller's local scope.
+ * Default behavior (creation in the ::request namespace)
+ * is now more consistently constrained by fully qualifying
+ * the default array names (see rivetCore.c). This should fix
+ * Bug #48963
+ */
Tcl_ObjSetVar2(req->interp, envvar, key, val, 0);
- Tcl_DecrRefCount(key);
- Tcl_DecrRefCount(val);
+ Tcl_DecrRefCount(key);
+ Tcl_DecrRefCount(val);
}
Tcl_DecrRefCount(envvar);
Modified: tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c Fri Nov 4 01:03:32 2016
@@ -412,12 +412,15 @@ Rivet_MergeConfig(apr_pool_t *p, void *b
RIVET_CONF_SELECT(rsc,base,overrides,rivet_default_error_script)
RIVET_CONF_SELECT(rsc,base,overrides,rivet_abort_script)
RIVET_CONF_SELECT(rsc,base,overrides,after_every_script)
- RIVET_CONF_SELECT(rsc,base,overrides,upload_max)
+ rsc->default_cache_size = base->default_cache_size;
rsc->separate_virtual_interps = base->separate_virtual_interps;
rsc->honor_header_only_reqs = base->honor_header_only_reqs;
rsc->separate_channels = base->separate_channels;
rsc->mpm_bridge = base->mpm_bridge;
+ rsc->upload_max = base->upload_max;
+ rsc->upload_dir = base->upload_dir;
+
RIVET_CONF_SELECT(rsc,base,overrides,upload_dir)
RIVET_CONF_SELECT(rsc,base,overrides,rivet_server_vars)
Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h Fri Nov 4 01:03:32 2016
@@ -63,11 +63,6 @@
/* End Configuration options */
-/* For Tcl 8.3/8.4 compatibility - see http://wiki.tcl.tk/3669 */
-#ifndef CONST84
-# define CONST84
-#endif
-
#define VAR_SRC_QUERYSTRING 1
#define VAR_SRC_POST 2
#define VAR_SRC_ALL 3
@@ -161,8 +156,8 @@ typedef struct _thread_worker_private ri
typedef int (RivetBridge_ServerInit) (apr_pool_t*,apr_pool_t*,apr_pool_t*,server_rec*);
typedef void (RivetBridge_ChildInit) (apr_pool_t* pPool,server_rec* s);
typedef int (RivetBridge_Request) (request_rec*,rivet_req_ctype);
-typedef apr_status_t (RivetBridge_Finalize)(void*);
-typedef rivet_thread_interp* (RivetBridge_Master_Interp) (void);
+typedef apr_status_t (RivetBridge_Finalize)(void*);
+typedef rivet_thread_interp* (RivetBridge_Master_Interp) (void);
typedef int (RivetBridge_Exit_Handler) (int);
typedef rivet_thread_interp* (RivetBridge_Thread_Interp)(rivet_thread_private*,rivet_server_conf *);
Added: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.c?rev=1767983&view=auto
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.c (added)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.c Fri Nov 4 01:03:32 2016
@@ -0,0 +1,219 @@
+/* mod_rivet_cache.c -- The mod_rivet cache */
+/*
+ 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.
+*/
+#include <apr_strings.h>
+
+#include "mod_rivet.h"
+#include "mod_rivet_cache.h"
+
+extern mod_rivet_globals* module_globals;
+
+/*
+ * -- Rivet_CreateCache
+ *
+ * Creates a per interpreter script cach
+ *
+ * Arguments:
+ * apr_pool_t *p - APR memory pool pointer,
+ * rivet_thread_interp* interp_obj - interpreter object
+ *
+ *
+ * Results:
+ * None
+ *
+ * Side Effects:
+ *
+ */
+
+void Rivet_CreateCache (apr_pool_t *p, rivet_thread_interp* interp_obj)
+{
+ interp_obj->objCacheList =
+ apr_pcalloc(p,(signed)((interp_obj->cache_size)*sizeof(char *)));
+ interp_obj->objCache =
+ apr_pcalloc(p,sizeof(Tcl_HashTable));
+
+ Tcl_InitHashTable(interp_obj->objCache,TCL_STRING_KEYS);
+}
+
+/*
+ * -- Rivet_CacheCleanup
+ *
+ * Cache clean-up. This function is called when a user configuration
+ * is changed thus invalidating the whole cache. A better solution is
+ * still to be found though
+ *
+ * Arguments:
+ * rivet_thread_interp* interp_obj - interpreter object
+ *
+ * Results:
+ * None
+ *
+ * Side Effects:
+ *
+ * the cache associated to the thread interpreter is emptied
+ */
+
+void Rivet_CacheCleanup (rivet_thread_private* private,rivet_thread_interp* rivet_interp)
+{
+ int ct;
+ Tcl_HashEntry *delEntry;
+
+ /* Clean out the list. */
+ ct = rivet_interp->cache_free;
+ while (ct < rivet_interp->cache_size) {
+ /* Free the corresponding hash entry. */
+ delEntry = Tcl_FindHashEntry(rivet_interp->objCache,
+ rivet_interp->objCacheList[ct]);
+
+ if (delEntry != NULL) {
+ Tcl_DecrRefCount((Tcl_Obj *)Tcl_GetHashValue(delEntry));
+ Tcl_DeleteHashEntry(delEntry);
+ rivet_interp->objCacheList[ct] = NULL;
+ }
+
+ ct++;
+ }
+ apr_pool_destroy(rivet_interp->pool);
+
+ /* let's recreate the cache list */
+
+ if (apr_pool_create(&rivet_interp->pool, private->pool) != APR_SUCCESS)
+ {
+ ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, module_globals->server,
+ MODNAME ": could not recreate cache private pool. Cache disabled");
+ rivet_interp->cache_free = rivet_interp->cache_size = 0;
+ }
+ else
+ {
+ rivet_interp->objCacheList = apr_pcalloc (rivet_interp->pool,
+ (signed)(rivet_interp->cache_size*sizeof(char *)));
+ rivet_interp->cache_free = rivet_interp->cache_size;
+ }
+
+}
+
+/*
+ * -- Rivet_MakeCacheKey
+ *
+ * Arguments:
+ * apr_pool_t* pool
+ * char* filename
+ * time_t ctime - file creation time
+ * time_t mtime - file last modification
+ * unsigned int user_conf - user configuration flag
+ * int toplevel - toplevel template
+ */
+
+char* Rivet_MakeCacheKey (apr_pool_t* pool,
+ char* filename,
+ time_t ctime,
+ time_t mtime,
+ unsigned int user_conf,
+ int toplevel)
+{
+ return (char*) apr_psprintf (pool, "%s%lx%lx%d-%d", filename,
+ mtime, ctime, toplevel, user_conf);
+}
+
+/*
+ * -- Rivet_CacheEntryLookup
+ *
+ * Cache entry lookiup. A hash table lookup key is created and an entry
+ * searched in the cache. If an entry is not found the function returns NULL
+ *
+ * Arguments:
+ * char* hashKey - key to the cache
+ * rivet_thread_interp* interp_obj - interpreter object
+ *
+ * Results:
+ * Tcl_HashEntry* entry object
+ *
+ * Side Effects:
+ *
+ */
+
+Tcl_HashEntry* Rivet_CacheEntryLookup (rivet_thread_interp* rivet_interp,char* hashKey)
+{
+ Tcl_HashEntry* entry = NULL;
+ int isNew = 0;
+
+ entry = Tcl_CreateHashEntry(rivet_interp->objCache, hashKey, &isNew);
+
+ if (isNew) {
+ return NULL;
+ } else {
+ return entry;
+ }
+
+}
+
+/*
+ * -- Rivet_CacheFetchScript
+ *
+ * Cache entry lookiup. A hash table lookup key is created and an entry
+ * searched in the cache. If an entry is not found the function returns NULL
+ *
+ * Arguments:
+ * Tcl_HashEntry* entry
+ *
+ * Results:
+ * Tcl_Obj* entry_object
+ *
+ * Side Effects:
+ *
+ */
+Tcl_Obj* Rivet_CacheFetchScript (Tcl_HashEntry* entry)
+{
+ return (Tcl_Obj *)Tcl_GetHashValue(entry);
+}
+
+/* -- Rivet_CacheStoreScript
+ *
+ */
+
+int Rivet_CacheStoreScript(rivet_thread_interp* rivet_interp, Tcl_HashEntry* entry, Tcl_Obj* script)
+{
+ if (rivet_interp->cache_size) {
+
+ if (rivet_interp->cache_free) {
+ char* hashKey = (char *) Tcl_GetHashKey (rivet_interp->objCache,entry);
+
+ /* 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 (script);
+ Tcl_SetHashValue (entry,(ClientData)script);
+
+ rivet_interp->objCacheList[--rivet_interp->cache_free] =
+ (char*) apr_pcalloc (rivet_interp->pool,(strlen(hashKey)+1)*sizeof(char));
+ strcpy(rivet_interp->objCacheList[rivet_interp->cache_free], hashKey);
+
+ return 0;
+
+ } else {
+ /* cache full */
+
+ return 1;
+ }
+
+ }
+ return 0;
+}
Added: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.h?rev=1767983&view=auto
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.h (added)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_cache.h Fri Nov 4 01:03:32 2016
@@ -0,0 +1,35 @@
+/* mod_rivet_cache.h -- The mod_rivet cache */
+/*
+ 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_cache_h__
+#define __mod_rivet_cache_h__
+
+EXTERN void Rivet_CreateCache (apr_pool_t *p, rivet_thread_interp* interp_obj);
+EXTERN void Rivet_CacheCleanup (rivet_thread_private* private,rivet_thread_interp* rivet_interp);
+EXTERN char* Rivet_MakeCacheKey (apr_pool_t* pool, char* filename,
+ time_t ctime,
+ time_t mtime,
+ unsigned int user_conf,
+ int toplevel);
+EXTERN Tcl_HashEntry* Rivet_CacheEntryLookup (rivet_thread_interp* rivet_interp,char* hashKey);
+EXTERN Tcl_Obj* Rivet_CacheFetchScript (Tcl_HashEntry* entry);
+EXTERN int Rivet_CacheStoreScript(rivet_thread_interp* rivet_interp, Tcl_HashEntry* entry, Tcl_Obj* script);
+
+#endif /* __mod_rivet_cache_h__ */
Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c Fri Nov 4 01:03:32 2016
@@ -141,9 +141,6 @@ void Rivet_PerInterpInit(rivet_thread_in
globals->rivet_ns = Tcl_CreateNamespace (interp,RIVET_NS,NULL,
(Tcl_NamespaceDeleteProc *)NULL);
- //globals->req = TclWeb_NewRequestObject (p);
- //globals->r = NULL;
- //globals->srec = s;
/* Eval Rivet's init.tcl file to load in the Tcl-level commands. */
@@ -172,24 +169,10 @@ void Rivet_PerInterpInit(rivet_thread_in
Tcl_DecrRefCount(rivet_tcl);
/* Initialize the interpreter with Rivet's Tcl commands. */
-
- if (private == NULL)
- {
- /* reduced core for the server init interpreter */
-
- // RIVET_OBJ_CMD ("inspect",Rivet_InspectCmd,private);
-
- }
- else
- {
- /* full fledged rivet core */
-
- Rivet_InitCore(interp,private);
-
- }
+ if (private != NULL) Rivet_InitCore(interp,private);
/* Create a global array with information about the server. */
- Rivet_InitServerVariables(interp, p );
+ Rivet_InitServerVariables(interp,p);
/* Loading into the interpreter commands in librivet.so */
/* Tcl Bug #3216070 has been solved with 8.5.10 and commands shipped with
@@ -233,25 +216,6 @@ void Rivet_PerInterpInit(rivet_thread_in
Tcl_Release(interp);
interp_obj->flags |= RIVET_INTERP_INITIALIZED;
}
-/*
- * Rivet_CreateCache --
- *
- * Arguments:
- * rsc: pointer to a server_rec structure
- *
- * Results:
- * None
- *
- * Side Effects:
- *
- */
-
-void Rivet_CreateCache (apr_pool_t *p, rivet_thread_interp* interp_obj)
-{
- interp_obj->objCacheList = apr_pcalloc(p, (signed)((interp_obj->cache_size)*sizeof(char *)));
- interp_obj->objCache = apr_pcalloc(p, sizeof(Tcl_HashTable));
- Tcl_InitHashTable(interp_obj->objCache, TCL_STRING_KEYS);
-}
/* -- Rivet_NewVHostInterp
*
@@ -315,8 +279,7 @@ rivet_thread_interp* Rivet_NewVHostInter
Rivet_CreateCache(pool,interp_obj);
}
- interp_obj->flags = 0;
-
+ interp_obj->flags = 0;
interp_obj->scripts = (running_scripts *) apr_pcalloc(pool,sizeof(running_scripts));
interp_obj->per_dir_scripts = apr_hash_make(pool);
@@ -438,7 +401,7 @@ rivet_thread_private* Rivet_CreatePrivat
private->thread_exit = 0;
private->exit_status = 0;
private->abort_code = NULL;
- private->request_init = Tcl_NewStringObj("::Rivet::initialize_request\n", -1);
+ private->request_init = Tcl_NewStringObj("::Rivet::initialize_request\n", -1);
private->request_cleanup = Tcl_NewStringObj("::Rivet::cleanup_request\n", -1);
Tcl_IncrRefCount(private->request_init);
Tcl_IncrRefCount(private->request_cleanup);
@@ -448,6 +411,26 @@ rivet_thread_private* Rivet_CreatePrivat
}
/*
+ * -- Rivet_ExecutionThreadInit
+ *
+ * We keep here the basic initilization each execution thread likely does
+ *
+ * - create the thread private data
+ * - create a Tcl channel
+ * - set up the Panic procedure
+ */
+
+rivet_thread_private* Rivet_ExecutionThreadInit (void)
+{
+ rivet_thread_private* private = Rivet_CreatePrivateData();
+ ap_assert(private != NULL);
+ private->channel = Rivet_CreateRivetChannel(private->pool,rivet_thread_key);
+ Rivet_SetupTclPanicProc();
+
+ return private;
+}
+
+/*
*-----------------------------------------------------------------------------
*
* -- Rivet_SetupTclPanicProc
@@ -723,42 +706,4 @@ int Rivet_chdir_file (const char *file)
return chdir_retval;
}
-/*
- * -- Rivet_CheckType (request_rec *r)
- *
- * Utility function internally used to determine which type
- * of file (whether rvt template or plain Tcl script) we are
- * dealing with. In order to speed up multiple tests the
- * the test returns an integer (RIVET_TEMPLATE) for rvt templates
- * or RIVET_TCLFILE for Tcl scripts
- *
- * Argument:
- *
- * request_rec*: pointer to the current request record
- *
- * Returns:
- *
- * integer number meaning the type of file we are dealing with
- *
- * Side effects:
- *
- * none.
- *
- */
-
-rivet_req_ctype
-Rivet_CheckType (request_rec *req)
-{
- rivet_req_ctype ctype = CTYPE_NOT_HANDLED;
-
- if ( req->content_type != NULL ) {
- if( STRNEQU( req->content_type, RIVET_TEMPLATE_CTYPE) ) {
- ctype = RIVET_TEMPLATE;
- } else if( STRNEQU( req->content_type, RIVET_TCLFILE_CTYPE) ) {
- ctype = RIVET_TCLFILE;
- }
- }
- return ctype;
-}
-
Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.h?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.h (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.h Fri Nov 4 01:03:32 2016
@@ -27,12 +27,12 @@ EXTERN void Rivet_CreateCache (apr_pool_
EXTERN rivet_thread_interp* Rivet_NewVHostInterp(apr_pool_t *pool,server_rec* s);
EXTERN void Rivet_ProcessorCleanup (void *data);
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_Panic TCL_VARARGS_DEF(CONST char *, arg1);
EXTERN Tcl_Channel* Rivet_CreateRivetChannel(apr_pool_t* pPool, apr_threadkey_t* rivet_thread_key);
EXTERN rivet_thread_private* Rivet_CreatePrivateData (void);
+EXTERN rivet_thread_private* Rivet_ExecutionThreadInit (void);
EXTERN rivet_thread_private* Rivet_SetupTclPanicProc (void);
EXTERN void Rivet_ReleaseRivetChannel (Tcl_Interp* interp, Tcl_Channel* channel);
Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.c Fri Nov 4 01:03:32 2016
@@ -27,6 +27,7 @@
#include "mod_rivet.h"
#include "mod_rivet_common.h"
+#include "mod_rivet_cache.h"
#include "rivetParser.h"
#include "rivetCore.h"
#include "apache_config.h"
@@ -35,6 +36,47 @@
extern mod_rivet_globals* module_globals;
extern apr_threadkey_t* rivet_thread_key;
+
+/*
+ * -- Rivet_CheckType (request_rec *r)
+ *
+ * Utility function internally used to determine which type
+ * of file (whether rvt template or plain Tcl script) we are
+ * dealing with. In order to speed up multiple tests the
+ * the test returns an integer (RIVET_TEMPLATE) for rvt templates
+ * or RIVET_TCLFILE for Tcl scripts
+ *
+ * Argument:
+ *
+ * request_rec*: pointer to the current request record
+ *
+ * Returns:
+ *
+ * integer number meaning the type of file we are dealing with
+ *
+ * Side effects:
+ *
+ * none.
+ *
+ */
+
+rivet_req_ctype
+Rivet_CheckType (request_rec *req)
+{
+ rivet_req_ctype ctype = CTYPE_NOT_HANDLED;
+
+ if ( req->content_type != NULL ) {
+ if (STRNEQU( req->content_type, RIVET_TEMPLATE_CTYPE) ) {
+ ctype = RIVET_TEMPLATE;
+ } else if ( STRNEQU( req->content_type, RIVET_TCLFILE_CTYPE) ) {
+ ctype = RIVET_TCLFILE;
+ }
+ }
+ return ctype;
+}
+
+
+
/* -- Rivet_PrintErrorMessage
*
* Utility function to print the error message stored in errorInfo
@@ -294,13 +336,14 @@ Rivet_ParseExecFile(rivet_thread_private
char* hashKey = NULL;
int isNew = 0;
int result = 0;
- rivet_thread_interp* rivet_interp;
+ rivet_thread_interp*
+ rivet_interp;
Tcl_Obj* outbuf = NULL;
Tcl_HashEntry* entry = NULL;
Tcl_Interp* interp;
time_t ctime;
time_t mtime;
- int res = 0;
+ int res = 0;
/* We have to fetch the interpreter data from the thread private environment */
@@ -317,41 +360,7 @@ Rivet_ParseExecFile(rivet_thread_private
if (USER_CONF_UPDATED(private->running_conf) && (rivet_interp->cache_size != 0) &&
(rivet_interp->cache_free < rivet_interp->cache_size))
{
- int ct;
- Tcl_HashEntry *delEntry;
-
- /* Clean out the list. */
- ct = rivet_interp->cache_free;
- while (ct < rivet_interp->cache_size) {
- /* Free the corresponding hash entry. */
- delEntry = Tcl_FindHashEntry(
- rivet_interp->objCache,
- rivet_interp->objCacheList[ct]);
-
- if (delEntry != NULL) {
- Tcl_DecrRefCount((Tcl_Obj *)Tcl_GetHashValue(delEntry));
- Tcl_DeleteHashEntry(delEntry);
- rivet_interp->objCacheList[ct] = NULL;
- }
-
- ct++;
- }
- apr_pool_destroy(rivet_interp->pool);
-
- /* let's recreate the cache list */
-
- if (apr_pool_create(&rivet_interp->pool, private->pool) != APR_SUCCESS)
- {
- ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, module_globals->server,
- MODNAME ": could not recreate cache private pool. Cache disabled");
- rivet_interp->cache_free = rivet_interp->cache_size = 0;
- }
- else
- {
- rivet_interp->objCacheList = apr_pcalloc (rivet_interp->pool,
- (signed)(rivet_interp->cache_size*sizeof(char *)));
- rivet_interp->cache_free = rivet_interp->cache_size;
- }
+ Rivet_CacheCleanup(private,rivet_interp);
}
/* If toplevel is 0, we are being called from Parse, which means
@@ -483,7 +492,7 @@ Rivet_ParseExecFile(rivet_thread_private
* -- 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'
+ * a Rivet template. This function is the core for command 'parse -string'
*
* Arguments:
*
@@ -507,7 +516,7 @@ Rivet_ParseExecString (rivet_thread_priv
Tcl_AppendToObj(outbuf, "\"\n", 2);
}
- Tcl_AppendToObj(outbuf, "\n", -1);
+ Tcl_AppendToObj(outbuf,"\n",-1);
res = Rivet_ExecuteAndCheck(private, outbuf);
Tcl_DecrRefCount(outbuf);
Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.h?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.h (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_generator.h Fri Nov 4 01:03:32 2016
@@ -26,6 +26,7 @@
#include "mod_rivet.h"
+extern int Rivet_CheckType (request_rec* r);
extern int Rivet_ParseExecFile (rivet_thread_private* req, char* filename, int toplevel);
extern int Rivet_ParseExecString (rivet_thread_private* req, Tcl_Obj* inbuf);
extern int Rivet_SendContent (rivet_thread_private* private,request_rec* r);
Modified: tcl/rivet/trunk/src/mod_rivet_ng/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/rivetCore.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/rivetCore.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/rivetCore.c Fri Nov 4 01:03:32 2016
@@ -45,10 +45,13 @@
#include <apr_strings.h>
#include "mod_rivet_generator.h"
+
#include "apache_request.h"
#include "mod_rivet.h"
+#include "mod_rivet_cache.h"
#include "rivet.h"
#include "TclWeb.h"
+#include "rivetParser.h"
#define ENV_ARRAY_NAME "::request::env"
#define HEADERS_ARRAY_NAME "::request::headers"
@@ -250,7 +253,7 @@ TCL_CMD_HEADER( Rivet_Parse )
return TCL_ERROR;
}
- return Rivet_ParseExecFile(private, filename, 0);
+ return Rivet_ParseExecFile(private,filename,0);
}
/*
@@ -1131,6 +1134,7 @@ TCL_CMD_HEADER ( Rivet_RawPost )
THREAD_PRIVATE_DATA(private)
CHECK_REQUEST_REC(private,"::rivet::raw_post")
+
data = TclWeb_GetRawPost(private->req);
if (!data) {
@@ -1164,6 +1168,7 @@ TCL_CMD_HEADER( Rivet_NoBody )
THREAD_PRIVATE_DATA(private)
CHECK_REQUEST_REC(private,"::rivet::no_body")
+
if (private->req->content_sent == 1) {
Tcl_AddErrorInfo(interp, "Content already sent");
return TCL_ERROR;
@@ -1306,8 +1311,8 @@ TCL_CMD_HEADER( Rivet_EnvCmd )
rivet_thread_private* private;
THREAD_PRIVATE_DATA(private)
-
CHECK_REQUEST_REC(private,"::rivet::env")
+
if( objc != 2 ) {
Tcl_WrongNumArgs( interp, 1, objv, "variable" );
return TCL_ERROR;
@@ -1729,6 +1734,99 @@ TestpanicCmd(dummy, interp, argc, argv)
/*
*-----------------------------------------------------------------------------
*
+ * Rivet_UrlScript --
+ *
+ * Builds the full URL referenced script composed by before_script,
+ * url referenced script and after_script. This command should not
+ * be called by ordinary application development
+ *
+ * Results:
+ * Standard Tcl result.
+ *
+ * Side Effects:
+ * returns a Tcl script.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+TCL_CMD_HEADER( Rivet_UrlScript )
+{
+ rivet_thread_private* private;
+ char* cache_key;
+ rivet_thread_interp* rivet_interp;
+ Tcl_HashEntry* entry = NULL;
+ Tcl_Obj* script = NULL;
+ int result;
+ unsigned int user_conf;
+ time_t ctime;
+ time_t mtime;
+
+ THREAD_PRIVATE_DATA(private)
+ CHECK_REQUEST_REC(private,"::rivet::url_script")
+
+ user_conf = IS_USER_CONF(private->running_conf);
+
+ rivet_interp = RIVET_PEEK_INTERP(private,private->running_conf);
+ ctime = private->r->finfo.ctime;
+ mtime = private->r->finfo.mtime;
+ cache_key = Rivet_MakeCacheKey(private->pool,private->r->filename,ctime,mtime,user_conf,1);
+
+ entry = Rivet_CacheEntryLookup (rivet_interp,cache_key);
+ if (entry == NULL)
+ {
+ Tcl_Interp* interp;
+
+ interp = rivet_interp->interp;
+
+ script = Tcl_NewObj();
+ Tcl_IncrRefCount(script);
+
+ if (private->running->rivet_before_script)
+ {
+ Tcl_AppendObjToObj(script,private->running->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 (Rivet_CheckType(private->r) == RIVET_TEMPLATE)
+ {
+ result = Rivet_GetRivetFile(private->r->filename, 1, script, interp);
+
+ } else {
+
+ /* It's a plain Tcl file */
+ result = Rivet_GetTclFile(private->r->filename, script, interp);
+
+ }
+
+ if (result != TCL_OK)
+ {
+ Tcl_DecrRefCount(script);
+ return result;
+ }
+
+ if (private->running->rivet_after_script) {
+ Tcl_AppendObjToObj(script,private->running->rivet_after_script);
+ }
+
+ Rivet_CacheStoreScript(rivet_interp,entry,script);
+ }
+ else
+ {
+ script = Rivet_CacheFetchScript(entry);
+ }
+
+ Tcl_SetObjResult(rivet_interp->interp, script);
+ return TCL_OK;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ *
* Rivet_InitCore --
*
* Creates the core rivet commands.
@@ -1769,6 +1867,7 @@ Rivet_InitCore(Tcl_Interp *interp,rivet_
RIVET_OBJ_CMD ("apache_log_error",Rivet_LogErrorCmd,private);
RIVET_OBJ_CMD ("inspect",Rivet_InspectCmd,private);
RIVET_OBJ_CMD ("exit",Rivet_ExitCmd,private);
+ RIVET_OBJ_CMD ("url_script",Rivet_UrlScript,private);
#ifdef TESTPANIC
RIVET_OBJ_CMD ("testpanic",TestpanicCmd,private);
@@ -1802,7 +1901,6 @@ Rivet_InitCore(Tcl_Interp *interp,rivet_
RIVET_EXPORT_CMD(interp,rivet_ns,"apache_log_error");
RIVET_EXPORT_CMD(interp,rivet_ns,"inspect");
// ::rivet::exit is not exported
- //Tcl_Export(interp,rivet_ns,"*",0);
}
#endif
Modified: tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c Fri Nov 4 01:03:32 2016
@@ -143,22 +143,15 @@ static void* APR_THREAD_FUNC request_pro
int idx;
rivet_server_conf* rsc;
- private = Rivet_CreatePrivateData();
- if (private == NULL)
- {
- /* TODO: we have to log something here */
- apr_thread_exit(thd,APR_SUCCESS);
- }
- private->channel = Rivet_CreateRivetChannel(private->pool,rivet_thread_key);
- Rivet_SetupTclPanicProc ();
-
rsc = RIVET_SERVER_CONF(w->server->module_config);
+ w->nreqs = 0;
+
+ private = Rivet_ExecutionThreadInit();
private->ext = apr_pcalloc(private->pool,sizeof(mpm_bridge_specific));
private->ext->keep_going = 1;
private->ext->interp = Rivet_NewVHostInterp(private->pool,w->server);
private->ext->interp->channel = private->channel;
- w->nreqs = 0;
Tcl_RegisterChannel(private->ext->interp->interp,*private->channel);
private->ext->interp->scripts =
Modified: tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c Fri Nov 4 01:03:32 2016
@@ -68,18 +68,11 @@ void Prefork_MPM_ChildInit (apr_pool_t*
* private data should have been created by the httpd parent process
*/
- private = Rivet_CreatePrivateData();
+ private = Rivet_ExecutionThreadInit();
private->ext = apr_pcalloc(private->pool,sizeof(mpm_bridge_specific));
private->ext->interps =
apr_pcalloc(private->pool,module_globals->vhosts_count*sizeof(rivet_thread_interp));
- Rivet_SetupTclPanicProc ();
- ap_assert(private != NULL);
-
- if (private->channel == NULL)
- {
- private->channel = Rivet_CreateRivetChannel(private->pool,rivet_thread_key);
- }
/* we now establish the full rivet core command set for the root interpreter */
Modified: tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c?rev=1767983&r1=1767982&r2=1767983&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c Fri Nov 4 01:03:32 2016
@@ -165,20 +165,12 @@ static void* APR_THREAD_FUNC request_pro
apr_thread_mutex_lock(module_globals->mpm->job_mutex);
- private = Rivet_CreatePrivateData();
+ private = Rivet_ExecutionThreadInit();
private->ext = apr_pcalloc(private->pool,sizeof(mpm_bridge_specific));
private->ext->keep_going = 1;
private->ext->interps =
apr_pcalloc(private->pool,module_globals->vhosts_count*sizeof(rivet_thread_interp));
- if (private == NULL)
- {
- /* TODO: we have to log something here */
- apr_thread_exit(thd,APR_SUCCESS);
- return NULL;
- }
- private->channel = Rivet_CreateRivetChannel(private->pool,rivet_thread_key);
- Rivet_SetupTclPanicProc();
/* So far nothing differs much with what we did for the prefork bridge */
@@ -506,8 +498,9 @@ void Worker_MPM_ChildInit (apr_pool_t* p
exit(1);
}
- /* In order to prepare load balancing let's query apache for some configuration
- * parameters of the worker MPM */
+ /* In order to set up some workload balancing let's
+ * query apache for some configuration parameters of the worker MPM
+ */
if (ap_mpm_query(AP_MPMQ_MAX_THREADS,&module_globals->mpm->max_threads) != APR_SUCCESS)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org