Mod Cplusplus CVS committal
Author : johnksterling
Project : mod_cplusplus
Module : src
Dir : mod_cplusplus/src
Modified Files:
apache_handler.cpp mod_cplusplus.c
Log Message:
add a new parameter passing mechanism to filters that is per server, not per dir
===================================================================
RCS file: /cvsroot/modcplusplus/mod_cplusplus/src/apache_handler.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- apache_handler.cpp 28 Jun 2004 02:52:32 -0000 1.15
+++ apache_handler.cpp 14 Dec 2004 13:17:04 -0000 1.16
@@ -191,6 +191,18 @@
}
}
+char *ApacheBase::get_server_var(ApacheServerRec *pServer, const char *name)
+{
+ cpp_server_rec *server_rec = NULL;
+ if( !name ) {
+ return NULL;
+ }
+ server_rec = (cpp_server_rec *)
+ pServer->get_module_config(&cplusplus_module);
+ char *value = (char *)apr_hash_get(server_rec->var_hash, name, strlen(name));
+ return value;
+}
+
char *ApacheBase::get_cpp_var(ApacheRequestRec *pRequest, const char *name)
{
cpp_config_rec *dir_rec = (cpp_config_rec *)
===================================================================
RCS file: /cvsroot/modcplusplus/mod_cplusplus/src/mod_cplusplus.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- mod_cplusplus.c 24 May 2004 01:33:54 -0000 1.20
+++ mod_cplusplus.c 14 Dec 2004 13:17:04 -0000 1.21
@@ -52,6 +52,7 @@
cpp_server_rec *new_config = (cpp_server_rec *)
apr_pcalloc(p, sizeof(*new_config));
new_config->handler_hash = apr_hash_make(p);
+ new_config->var_hash = apr_hash_make(p);
new_config->input_filter_hash = apr_hash_make(p);
new_config->output_filter_hash = apr_hash_make(p);
new_config->protocol_hash = apr_hash_make(p);
@@ -74,6 +75,17 @@
return load_cpp_module(cmd->server->process->pool, server_rec, name, path_to_so);
}
+static const char *pass_server_var(cmd_parms *cmd, void *config,
+ const char *name,
+ const char *value)
+{
+ cpp_server_rec *server_rec = (cpp_server_rec *)
+ ap_get_module_config(cmd->server->module_config,
+ &cplusplus_module);
+ apr_hash_set(server_rec->var_hash, name, strlen(name), value);
+ return NULL;
+}
+
static const char *pass_var(cmd_parms *cmd, void *config,
const char *name,
const char *value)
@@ -232,7 +244,9 @@
RSRC_CONF,
"add protocol handler"),
AP_INIT_TAKE2("PassCPPVar", pass_var, NULL, OR_FILEINFO,
- "pass var to cpp handlers"),
+ "pass var to cpp handlers via request config (per dir)"),
+ AP_INIT_TAKE2("PassCPPServerVar", pass_server_var, NULL, RSRC_CONF,
+ "pass var to cpp handlers via server config"),
{NULL}
};
|