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 da...@apache.org on 2003/03/15 02:24:10 UTC
cvs commit: tcl-rivet/src mod_rivet.c
davidw 2003/03/14 17:24:10
Modified: src mod_rivet.c
Log:
* src/mod_rivet.c (Rivet_AppendToScript): Don't append
Before/After/Error scripts. Just override them. (Rivet_UserConf):
Switch back to usig Rivet_AppendToScript. (Rivet_SetScript): Change
Rivet_AppendToScript to Rivet_SetScript to reflect the fact that it
doesn't always append - specifically, in After/Before/Error scripts.
Revision Changes Path
1.61 +28 -29 tcl-rivet/src/mod_rivet.c
Index: mod_rivet.c
===================================================================
RCS file: /home/cvs/tcl-rivet/src/mod_rivet.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- mod_rivet.c 13 Mar 2003 08:06:38 -0000 1.60
+++ mod_rivet.c 15 Mar 2003 01:24:10 -0000 1.61
@@ -712,8 +712,28 @@
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * 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.
+ *
+ * Results:
+ *
+ * Returns the string representation of the current value for the
+ * directive.
+ *
+ *----------------------------------------------------------------------
+ */
+
static char *
-Rivet_AppendToScript( ap_pool *pool, rivet_server_conf *rsc, char *script, char *string )
+Rivet_SetScript( ap_pool *pool, rivet_server_conf *rsc, char *script, char *string )
{
Tcl_Obj *objarg = NULL;
@@ -751,26 +771,11 @@
Tcl_AppendToObj( objarg, "\n", 1 );
}
} else if( STREQU( script, "BeforeScript" ) ) {
- if( rsc->rivet_before_script == NULL ) {
- rsc->rivet_before_script = ap_pstrcat(pool, string, "\n", NULL);
- } else {
- rsc->rivet_before_script = ap_pstrcat(pool, rsc->rivet_before_script,
- string, "\n", NULL);
- }
+ rsc->rivet_before_script = ap_pstrcat(pool, string, "\n", NULL);
} else if( STREQU( script, "AfterScript" ) ) {
- if( rsc->rivet_after_script == NULL ) {
- rsc->rivet_after_script = ap_pstrcat(pool, string, "\n", NULL);
- } else {
- rsc->rivet_after_script = ap_pstrcat(pool, rsc->rivet_after_script,
- string, "\n", NULL);
- }
+ rsc->rivet_after_script = ap_pstrcat(pool, string, "\n", NULL);
} else if( STREQU( script, "ErrorScript" ) ) {
- if( rsc->rivet_error_script == NULL ) {
- rsc->rivet_error_script = ap_pstrcat(pool, string, "\n", NULL);
- } else {
- rsc->rivet_error_script = ap_pstrcat(pool, rsc->rivet_error_script,
- string, "\n", NULL);
- }
+ rsc->rivet_error_script = ap_pstrcat(pool, string, "\n", NULL);
}
if( !objarg ) return string;
@@ -827,7 +832,7 @@
rsc->seperate_virtual_interps = 0;
}
} else {
- string = Rivet_AppendToScript( cmd->pool, rsc, var, val);
+ string = Rivet_SetScript( cmd->pool, rsc, var, val);
}
ap_table_set( rsc->rivet_server_vars, var, string );
@@ -857,7 +862,7 @@
if( STREQU( var, "UploadDirectory" ) ) {
rdc->upload_dir = val;
} else {
- string = Rivet_AppendToScript( cmd->pool, rdc, var, val );
+ string = Rivet_SetScript( cmd->pool, rdc, var, val );
}
ap_table_set( rdc->rivet_dir_vars, var, string );
@@ -885,13 +890,7 @@
/* We have modified these scripts. */
rdc->user_scripts_updated = 1;
- if( STREQU( var, "BeforeScript" ) ) {
- rdc->rivet_before_script = ap_pstrcat(cmd->pool, val, "\n", NULL);
- } else if( STREQU( var, "AfterScript" ) ) {
- rdc->rivet_after_script = ap_pstrcat(cmd->pool, val, "\n", NULL);
- } else if( STREQU( var, "ErrorScript" ) ) {
- rdc->rivet_error_script = ap_pstrcat(cmd->pool, val, "\n", NULL);
- }
+ string = Rivet_SetScript( cmd->pool, rdc, var, val );
/* XXX Need to figure out what to do about setting the table. */
ap_table_set( rdc->rivet_user_vars, var, string );
return( NULL );
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org