You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by ka...@apache.org on 2005/09/25 10:16:00 UTC
svn commit: r291390 - in /tcl/rivet/trunk: ChangeLog src/mod_rivet.c
src/mod_rivet.h src/rivetCore.c
Author: karl
Date: Sun Sep 25 01:15:49 2005
New Revision: 291390
URL: http://svn.apache.org/viewcvs?rev=291390&view=rev
Log:
Updated code comments. In particular, every function in src/mod_rivet.c
now has a standard header.
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/src/mod_rivet.c
tcl/rivet/trunk/src/mod_rivet.h
tcl/rivet/trunk/src/rivetCore.c
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewcvs/tcl/rivet/trunk/ChangeLog?rev=291390&r1=291389&r2=291390&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Sun Sep 25 01:15:49 2005
@@ -1,3 +1,9 @@
+2005-09-25 Karl Lehenbauer <ka...@sc.com>
+
+ * src/rivetCore.c, src/mod_rivet.c, src/mod_rivet.h: Updated
+ code comments. In particular, every function in src/mod_rivet.c
+ now has a standard header.
+
2005-09-23 David N. Welton <da...@dedasys.com>
* genconf.sh: Added autoheaders.
Modified: tcl/rivet/trunk/src/mod_rivet.c
URL: http://svn.apache.org/viewcvs/tcl/rivet/trunk/src/mod_rivet.c?rev=291390&r1=291389&r2=291390&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/mod_rivet.c Sun Sep 25 01:15:49 2005
@@ -81,11 +81,33 @@
}
#endif /* 0 */
-
-/* Calls Tcl_EvalObjEx() and checks for errors
- * Prints the error buffer if any.
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_ExecuteAndCheck --
+ *
+ * Given a Tcl interpreter, an output buffer Tcl object, and an
+ * Apache request record, evaluate the buffer as Tcl code.
+ *
+ * (Since we're evaluating an object, it'll be compiled and the
+ * compliation cached in the object by Tcl's on-the-fly bytecode
+ * compiler.)
+ *
+ * If there's an error, figure out if it was caused by abort_page
+ * and if so, simply abort the page. Otherwise, execute the
+ * custom error handler, if defined, else use the default error handler.
+ *
+ * If the error handler gets an error, handle that with a primitive,
+ * last-ditch error-in-error-handler error handler.
+ *
+ * Results:
+ * TCL_OK
+ *
+ * Side Effects:
+ * The webpage is emitted.
+ *
+ *-----------------------------------------------------------------------------
*/
-
static int
Rivet_ExecuteAndCheck(Tcl_Interp *interp, Tcl_Obj *outbuf, request_rec *r)
{
@@ -163,7 +185,34 @@
return TCL_OK;
}
-/* This is a separate function so that it may be called from 'Parse' */
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_ParseExecFile --
+ *
+ * Given a Tcl Web Request structure, a filename, and a toplevel
+ * flag...
+ *
+ * If the user scripts have been updated and the page has been
+ * cached, get rid of the cached page.
+ *
+ * If the toplevel flag is zero, stat the file for the ctime and
+ * mtime, else get the ctime and mtime from the req structure.
+ *
+ * If caching is enabled, see if it's cached, handle caching it,
+ * freeing the cache, etc.
+ *
+ * This is a separate function so that it may be called from 'parse' as
+ * well as Rivet_SendContent.
+ *
+ * Results:
+ * A Tcl result is returned.
+ *
+ * Side Effects:
+ * The webpage is emitted.
+ *
+ *-----------------------------------------------------------------------------
+ */
int
Rivet_ParseExecFile(TclWebRequest *req, char *filename, int toplevel)
{
@@ -211,7 +260,6 @@
*(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)
@@ -312,9 +360,23 @@
}
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_CleanupRequest --
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------------
+ */
static void
Rivet_CleanupRequest( request_rec *r )
{
+/* FIXME why is this all ifdef'ed out? */
#if 0
table *t;
array_header *arr;
@@ -355,6 +417,27 @@
#endif
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_PropagatePerDirConfArrays --
+ *
+ * Propagate all of the Rivet DirConf variables and Rivet
+ * UserConf variables defined in the Apache config
+ * (typically httpd.conf) into an array.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * A global RivetServerConf array is populated with ServerConf
+ * variables and values.
+ *
+ * A global RivetUserConf array is populated with UserConf
+ * variables and values.
+ *
+ *-----------------------------------------------------------------------------
+ */
static void
Rivet_PropagatePerDirConfArrays( Tcl_Interp *interp, rivet_server_conf *rsc )
{
@@ -367,9 +450,11 @@
Tcl_Obj *val;
/* Make sure RivetDirConf doesn't exist from a previous request. */
+
Tcl_UnsetVar( interp, "RivetDirConf", TCL_GLOBAL_ONLY );
/* Propagate all of the DirConf variables into an array. */
+
t = rsc->rivet_dir_vars;
arr = ap_table_elts( t );
elts = (table_entry *)arr->elts;
@@ -394,9 +479,11 @@
Tcl_DecrRefCount(arrayName);
/* Make sure RivetUserConf doesn't exist from a previous request. */
+
Tcl_UnsetVar( interp, "RivetUserConf", TCL_GLOBAL_ONLY );
/* Propagate all of the UserConf variables into an array. */
+
t = rsc->rivet_user_vars;
arr = ap_table_elts( t );
elts = (table_entry *)arr->elts;
@@ -422,6 +509,30 @@
}
/* Set things up to execute a file, then execute */
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_SendContent --
+ *
+ * Process and send a page, whether x-httpd-rivet style or
+ * x-rivet-tcl style.
+ *
+ * Validate that they're allowed to execute us and that the file
+ * exists.
+ *
+ * Generate the Rivet server conf by merging per directory config
+ * stuff appropriate to this page.
+ *
+ *
+ * Results:
+ * An Apache webserver result code such as OK, HTTP_BAD_REQUEST,
+ * HTTP_NOT_FOUND, etc, is returned.
+ *
+ * Side Effects:
+ * A webpage or webpage header or some kind of error is emitted.
+ *
+ *-----------------------------------------------------------------------------
+ */
static int
Rivet_SendContent(request_rec *r)
{
@@ -482,6 +593,8 @@
Apache 2.0, or one of them, at least. */
ap_chdir_file(r->filename);
+ /* Generate the Rivet server conf by merging per directory config
+ * stuff appropriate to this page. */
Rivet_PropagatePerDirConfArrays( interp, rdc );
/* Initialize this the first time through and keep it around. */
@@ -489,6 +602,9 @@
request_init = Tcl_NewStringObj("::Rivet::initialize_request\n", -1);
Tcl_IncrRefCount(request_init);
}
+
+ /* prep the special ::request namespace by executing the
+ * initialize_request proc from the Rivet package */
if (Tcl_EvalObjEx(interp, request_init, 0) == TCL_ERROR)
{
ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
@@ -507,7 +623,7 @@
Tcl_DecrRefCount(infoscript);
#else
/* This speeds things up, but you have to use Tcl internal
- * declerations, which is not so great... */
+ * declarations, which is not so great... */
Interp *iPtr = (Interp *) interp;
if (iPtr->scriptFile != NULL) {
Tcl_DecrRefCount(iPtr->scriptFile);
@@ -572,21 +688,36 @@
}
/*
- * 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.
- *
- * 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_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 gets called once, when the child process is created.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ *
+ * A global server array is populated with the following variables:
+ *
+ * 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
+ *-----------------------------------------------------------------------------
*/
+
static void
Rivet_InitServerVariables( Tcl_Interp *interp, pool *p )
{
Tcl_Obj *obj;
+ /* Create server(SERVER_ROOT) from Apache's ap_server_root */
obj = Tcl_NewStringObj(ap_server_root, -1);
Tcl_IncrRefCount(obj);
Tcl_SetVar2Ex(interp,
@@ -596,6 +727,7 @@
TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(obj);
+ /* Create server(SERVER_CONF) from Apache's ap_server_confname */
obj = Tcl_NewStringObj(ap_server_root_relative(p, ap_server_confname), -1);
Tcl_IncrRefCount(obj);
Tcl_SetVar2Ex(interp,
@@ -605,6 +737,7 @@
TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(obj);
+ /* Create server(RIVET_DIR) */
obj = Tcl_NewStringObj(ap_server_root_relative(p, RIVET_DIR), -1);
Tcl_IncrRefCount(obj);
Tcl_SetVar2Ex(interp,
@@ -614,6 +747,7 @@
TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(obj);
+ /* Create server(RIVET_INIT) */
obj = Tcl_NewStringObj(ap_server_root_relative(p, RIVET_INIT), -1);
Tcl_IncrRefCount(obj);
Tcl_SetVar2Ex(interp,
@@ -624,6 +758,24 @@
Tcl_DecrRefCount(obj);
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_PropagateServerConfArray --
+ *
+ * Propagate all of the Rivet ServerConf variables defined in the
+ * Apache config (typically httpd.conf) into an array.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * A global RivetServerConf array is populated with ServerConf
+ * variables and values.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
static void
Rivet_PropagateServerConfArray( Tcl_Interp *interp, rivet_server_conf *rsc )
{
@@ -673,7 +825,28 @@
* None.
*
* Side Effects:
- * None.
+ *
+ * A Tcl channel handler is defined to allow Tcl "puts" to stdout
+ * to cause its output to be folded into the webpage being generated.
+ *
+ * Core Rivet commands such as header, load_env, var, etc, are
+ * added to the interpreter.
+ *
+ * The global "server" array is populated.
+ *
+ * The RivetServerConf array is populated with Rivet ServerConf
+ * data from the Apache config file(s).
+ *
+ * A rivet_interp_globals area is set up and made available as
+ * associated data of the Tcl interpreter.
+ *
+ * A "package require rivet" is performed to load the Rivet package,
+ * effectively causing Rivet's init.tcl to be loaded, defining all
+ * Tcl-based procs that are part of Rivet.
+ *
+ * The Tcl output buffer size is set to the largest allowed value to
+ * keep any results from getting output unless the Rivet page does
+ * a flush on stdout.
*
*-----------------------------------------------------------------------------
*/
@@ -691,19 +864,20 @@
Tcl_SetStdChannel(*(rsc->outchannel), TCL_STDOUT);
- /* Initialize the interpreter with Rivet's Tcl commands. */
+ /* Add Rivet's core commands to the interpreter. */
Rivet_InitCore( interp );
/* Create a global array with information about the server. */
Rivet_InitServerVariables( interp, p );
Rivet_PropagateServerConfArray( interp, rsc );
- /* Set up interpreter associated data */
+ /* Set up interpreter-associated data -- this makes it possible for
+ * us to locate rivet_interp_globals given an interpreter pointer */
globals = ap_pcalloc(p, sizeof(rivet_interp_globals));
Tcl_SetAssocData(interp, "rivet", NULL, globals);
- /* Eval Rivet's init.tcl file to load in the Tcl-level
- commands. */
+ /* Require the RivetTcl package, causing Rivet's init.tcl file to load in
+ * Rivet's Tcl-level commands. */
if (Tcl_PkgRequire(interp, "RivetTcl", "1.1", 1) == NULL) {
ap_log_error( APLOG_MARK, APLOG_ERR, s,
"init.tcl must be installed correctly for Apache Rivet to function: %s",
@@ -762,11 +936,24 @@
* Initialize the Tcl system - create interpreters, load commands
* and so forth.
*
+ * This is called whenever an individual Apache child process is
+ * created.
+ *
* Results:
* None.
*
* Side Effects:
- * None.
+ * A Tcl interpreter is created and initialized.
+ *
+ * A custom Rivet Tcl panic proc is set up.
+ *
+ * Rivet_PerInterpInit is performed, creating the Tcl stdout output
+ * handler, adding core Rivet commands to the interpreter, etc.
+ * (See Rivet_PerInterpInit for details.)
+ *
+ * Space for the cache of compiled Rivet pages is allocated.
+ *
+ * The global Rivet Tcl init script is executed, if defined.
*
*-----------------------------------------------------------------------------
*/
@@ -827,6 +1014,7 @@
Tcl_InitHashTable(rsc->objCache, TCL_STRING_KEYS);
}
+ /* Execute the global Rivet Tcl init script, if defined */
if (rsc->rivet_global_init_script != NULL) {
if (Tcl_EvalObjEx(interp, rsc->rivet_global_init_script, 0) != TCL_OK)
{
@@ -835,13 +1023,18 @@
}
}
- sr = s;
- while (sr)
+ /* for all of the server_recs */
+ for (sr = s; sr; sr = sr->next)
{
myrsc = RIVET_SERVER_CONF(sr->module_config);
+
/* We only have a different rivet_server_conf if MergeConfig
* was called. We really need a separate one for each server,
* so we go ahead and create one here, if necessary. */
+
+ /* if it's not the first one and it has the same module config
+ * as the first one, clone the module config
+ */
if (sr != s && myrsc == rsc) {
myrsc = RIVET_NEW_CONF(p);
ap_set_module_config(sr->module_config, &rivet_module, myrsc);
@@ -872,28 +1065,37 @@
myrsc->objCacheList = rsc->objCacheList;
}
myrsc->server_name = ap_pstrdup(p, sr->server_hostname);
-
- sr = sr->next;
}
}
-
/*
*----------------------------------------------------------------------
*
* Rivet_SetScript --
*
- * Add the text from an apache directive, such as UserConf, to
- * the corresponding variable in the rivet_server_conf structure.
- * In most cases, we append the new value to any previously
- * existing value, but Before, After and Error scripts override
- * the old directive completely.
+ * Given a script name from a Rivet Apache directive, such as UserConf,
+ * ChildInitScript, etc, and a corresponding string, create or add
+ * the string to the corresponding variable in the rivet_server_conf
+ * structure.
+ *
+ * In the cases of GlobalInitScript, ChildInitScript and ChildExitScript,
+ * if multiple entries are defined, they are appended together, separated
+ * by newlines, and stored as Tcl objects.
+ *
+ * For the cases of BeforeScript, AfterScript, and ErrorScript, the
+ * new values overrides the old value, if any was previously defined.
+ * These are stored only as strings, not Tcl objects, as they are
+ * massaged into the text that is ultimately evaluated to produce the
+ * webpage output.
*
* Results:
- *
* Returns the string representation of the current value for the
* directive.
*
+ * Side Effects:
+ * An element of the passed rivet_server_conf structure is
+ * created or appended to.
+ *
*----------------------------------------------------------------------
*/
@@ -949,21 +1151,34 @@
}
/*
- * Implements the RivetServerConf Apache Directive
+ *----------------------------------------------------------------------
+ *
+ * Rivet_ServerConf --
+ *
+ * Implements the RivetServerConf Apache Directive
+ *
+ * Command Arguments:
+ *
+ * RivetServerConf GlobalInitScript <script>
+ * RivetServerConf ChildInitScript <script>
+ * RivetServerConf ChildExitScript <script>
+ * RivetServerConf BeforeScript <script>
+ * RivetServerConf AfterScript <script>
+ * RivetServerConf ErrorScript <script>
+ * RivetServerConf CacheSize <integer>
+ * RivetServerConf UploadDirectory <directory>
+ * RivetServerConf UploadMaxSize <integer>
+ * RivetServerConf UploadFilesToVar <yes|no>
+ * RivetServerConf SeparateVirtualInterps <yes|no>
+ *
+ * Results:
+ * None.
*
- * Command Arguments:
- * RivetServerConf GlobalInitScript <script>
- * RivetServerConf ChildInitScript <script>
- * RivetServerConf ChildExitScript <script>
- * RivetServerConf BeforeScript <script>
- * RivetServerConf AfterScript <script>
- * RivetServerConf ErrorScript <script>
- * RivetServerConf CacheSize <integer>
- * RivetServerConf UploadDirectory <directory>
- * RivetServerConf UploadMaxSize <integer>
- * RivetServerConf UploadFilesToVar <yes|no>
- * RivetServerConf SeparateVirtualInterps <yes|no>
-*/
+ * Side Effects:
+ * A field in the rivet_server_conf table gets set.
+ *
+ *----------------------------------------------------------------------
+ */
static const char *
Rivet_ServerConf( cmd_parms *cmd, void *dummy, char *var, char *val )
@@ -997,14 +1212,28 @@
}
/*
- * Implements the RivetDirConf Apache Directive
+ *----------------------------------------------------------------------
+ *
+ * Rivet_DirConf --
+ *
+ * Implements the RivetDirConf Apache Directive
+ *
+ * Command Arguments:
*
- * Command Arguments:
- * RivetDirConf BeforeScript <script>
- * RivetDirConf AfterScript <script>
- * RivetDirConf ErrorScript <script>
- * RivetDirConf UploadDirectory <directory>
-*/
+ * RivetDirConf BeforeScript <script>
+ * RivetDirConf AfterScript <script>
+ * RivetDirConf ErrorScript <script>
+ * RivetDirConf UploadDirectory <directory>
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * A field in the rivet_dir_vars table in the rivet_server_conf
+ * structure gets set.
+ *
+ *----------------------------------------------------------------------
+ */
static const char *
Rivet_DirConf( cmd_parms *cmd, rivet_server_conf *rdc, char *var, char *val )
{
@@ -1027,13 +1256,26 @@
}
/*
- * Implements the RivetUserConf Apache Directive
+ *----------------------------------------------------------------------
+ *
+ * Rivet_UserConf --
+ *
+ * Implements the RivetUserConf Apache Directive
+ *
+ * Command Arguments:
+ * RivetUserConf BeforeScript <script>
+ * RivetUserConf AfterScript <script>
+ * RivetUserConf ErrorScript <script>
+ *
+ * Results:
+ * None.
*
- * Command Arguments:
- * RivetUserConf BeforeScript <script>
- * RivetUserConf AfterScript <script>
- * RivetUserConf ErrorScript <script>
-*/
+ * Side Effects:
+ * A field in the rivet_user_vars table in the rivet_server_conf
+ * structure gets set.
+ *
+ *----------------------------------------------------------------------
+ */
static const char *
Rivet_UserConf( cmd_parms *cmd, rivet_server_conf *rdc, char *var, char *val )
{
@@ -1055,9 +1297,24 @@
return( NULL );
}
-
/*
- * Merge the per-directory configuration options into a new configuration.
+ *----------------------------------------------------------------------
+ *
+ * Rivet_MergeDirConfigVars --
+ *
+ * Given a base Rivet server config structure, a new Rivet server
+ * config structure, and a Rivet server config structure to add,
+ * merge the base and add structures to produce the new structure.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * If there is an "add" BeforeScript, use that, otherwise use
+ * the base one. Same for AfterScript, ErrorScript, UploadDir,
+ * etc.
+ *
+ *----------------------------------------------------------------------
*/
static void
Rivet_MergeDirConfigVars( pool *p, rivet_server_conf *new,
@@ -1093,6 +1350,27 @@
}
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * Rivet_GetConf --
+ *
+ * Given an Apache request record, dig the Rivet server config structure
+ * out of the specified Apache request_rec structure.
+ *
+ * If there is no per directory config, just return the server
+ * config. Otherwise make a copy of the config and merge the
+ * per-directory config vars.
+ *
+ * Results:
+ * A Rivet server conf structure set up appropriately for the
+ * specified Apache request.
+ *
+ * Side Effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
/* Function to get a config and merge the directory/server options */
rivet_server_conf *
Rivet_GetConf( request_rec *r )
@@ -1125,13 +1403,13 @@
*
* Rivet_CopyConfig --
*
- * Copy the rivet_server_conf struct.
+ * Copy the contents of a rivet_server_conf struct into another one.
*
* Results:
* None.
*
* Side Effects:
- * None.
+ * The new Rivet server conf is populated with data from the old one.
*
*-----------------------------------------------------------------------------
*/
@@ -1171,6 +1449,23 @@
newrsc->outchannel = oldrsc->outchannel;
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_CreateConfig --
+ *
+ * Given an Apache pool and an Apache server record, create a new
+ * Rivet server config and initialize it.
+ *
+ * Results:
+ * The new Rivet server config is returned.
+ *
+ * Side Effects:
+ * The Rivet server config is allocated as part of the specified pool.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
static void *
Rivet_CreateConfig( pool *p, server_rec *s )
{
@@ -1213,6 +1508,26 @@
return rsc;
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_CreateDirConfig --
+ *
+ * Given an Apache pool and dir string, generate a Rivet server
+ * conf structure and create the server vars, dir vars and user
+ * vars tables within it.
+ *
+ * FIXME "dir" isn't used?
+ *
+ * Results:
+ * The new Rivet server config is returned.
+ *
+ * Side Effects:
+ * The Rivet server config is allocated as part of the specified pool.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
void *
Rivet_CreateDirConfig(pool *p, char *dir)
{
@@ -1227,6 +1542,24 @@
return rdc;
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_MergeDirConfig --
+ *
+ * Given an Apache pool, a base Rivet server conf and an add Rivet
+ * server conf, allocate a new Rivet server and merge the directory
+ * config vars from the base and add configs into the new config.
+ *
+ * Results:
+ * The new Rivet server config containing merged dir configs is returned.
+ *
+ * Side Effects:
+ * The new Rivet server config is allocated as part of the specified pool.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
void *
Rivet_MergeDirConfig( pool *p, void *basev, void *addv )
{
@@ -1399,7 +1732,8 @@
* None.
*
* Side Effects:
- * Calls Tcl initialization function.
+ * Calls Tcl initialization functions for the new child process and
+ * causes the ChildInitScript to be executed, if it is defined.
*
*-----------------------------------------------------------------------------
*/
@@ -1416,13 +1750,16 @@
*
* Rivet_ChildExit --
*
- * Run when each Apache child process is about to exit.
+ * Perform Rivet end-of-child processing.
*
* Results:
* None.
*
* Side Effects:
- * Runs Tcl_Finalize.
+ * Runs the ChildExitScript, if defined, and executes Tcl_Finalize
+ * to perform Tcl's own cleanup housekeeping without having Tcl
+ * exit, as Tcl_Exit would do, so that Apache can do the rest of
+ * it's child completion thing.
*
*-----------------------------------------------------------------------------
*/
@@ -1436,6 +1773,23 @@
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Rivet_InitHandler --
+ *
+ * Perform Rivet module initialization -- called by Apache
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Uses the ap_add_version_component API to put Rivet in the
+ * "Server" header line sent back with the webpage.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
MODULE_VAR_EXPORT void
Rivet_InitHandler(server_rec *s, pool *p)
{
@@ -1446,6 +1800,9 @@
#endif /* !HIDE_RIVET_VERSION */
}
+/* Define Rivet handlers -- two kinds, Rivet pages containing HTML and
+ * Rivet code, and pure programs.
+ */
const handler_rec rivet_handlers[] =
{
{"application/x-httpd-rivet", Rivet_SendContent},
@@ -1453,6 +1810,7 @@
{NULL}
};
+/* Define Rivet commands to be provided to the Apache config file(s) */
const command_rec rivet_cmds[] =
{
{"RivetServerConf", Rivet_ServerConf, NULL, RSRC_CONF, TAKE2, NULL},
@@ -1462,6 +1820,7 @@
{NULL}
};
+/* Define the Rivet module to Apache */
module MODULE_VAR_EXPORT rivet_module =
{
STANDARD_MODULE_STUFF,
Modified: tcl/rivet/trunk/src/mod_rivet.h
URL: http://svn.apache.org/viewcvs/tcl/rivet/trunk/src/mod_rivet.h?rev=291390&r1=291389&r2=291390&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet.h (original)
+++ tcl/rivet/trunk/src/mod_rivet.h Sun Sep 25 01:15:49 2005
@@ -54,26 +54,26 @@
* Rivet_CreateConfig, Rivet_MergeConfig and so on. */
typedef struct {
- Tcl_Interp *server_interp; /* per server Tcl interpreter */
- Tcl_Obj *rivet_global_init_script; /* run once when apache is started */
- Tcl_Obj *rivet_child_init_script;
- Tcl_Obj *rivet_child_exit_script;
- char *rivet_before_script; /* script run before each page */
- char *rivet_after_script; /* after */
- char *rivet_error_script; /* for errors */
+ Tcl_Interp *server_interp; /* per server Tcl interpreter */
+ Tcl_Obj *rivet_global_init_script; /* run once when apache is started */
+ Tcl_Obj *rivet_child_init_script; /* run each time an httpd child starts */
+ Tcl_Obj *rivet_child_exit_script; /* run each time an httpd child exits */
+ char *rivet_before_script; /* script run before each page */
+ char *rivet_after_script; /* after */
+ char *rivet_error_script; /* for errors */
/* This flag is used with the above directives. If any of them
have changed, it gets set. */
int user_scripts_updated;
Tcl_Obj *rivet_default_error_script; /* for errors */
- int *cache_size;
- int *cache_free;
- int upload_max;
- int upload_files_to_var;
- int separate_virtual_interps;
- char *server_name;
- char *upload_dir;
+ int *cache_size; /* # of compiled rivet pages to cache */
+ int *cache_free; /* # of free compiled page cache slots */
+ int upload_max; /* max allowable upload filesize */
+ int upload_files_to_var; /* true if files are uploaded to a var */
+ int separate_virtual_interps; /* true if one-interp-per-page enabled */
+ char *server_name; /* server_hostname from apache (used?) */
+ char *upload_dir; /* dir to upload files to */
table *rivet_server_vars;
table *rivet_dir_vars;
table *rivet_user_vars;
Modified: tcl/rivet/trunk/src/rivetCore.c
URL: http://svn.apache.org/viewcvs/tcl/rivet/trunk/src/rivetCore.c?rev=291390&r1=291389&r2=291390&view=diff
==============================================================================
--- tcl/rivet/trunk/src/rivetCore.c (original)
+++ tcl/rivet/trunk/src/rivetCore.c Sun Sep 25 01:15:49 2005
@@ -913,7 +913,8 @@
* A standard Tcl result.
*
* Side Effects:
- * Creates new commands.
+ * Adds core Rivet commands to the specified Tcl interpreter, such
+ * as makeurl, headers, load_env, load_headers, var, etc.
*
*-----------------------------------------------------------------------------
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org