const command_rec *cmd;
/** per_dir_config vector passed to handle_command */
- void *context;
+ struct ap_conf_vector_t *context;
/** directive with syntax error */
const ap_directive_t *err_directive;
};
* @deffunc char *ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool, cmd_parms *parms, ap_directive_t **current, ap_directive_t **curr_parent, char *orig_directive)
*/
const char * ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool,
- cmd_parms *parms,
- ap_directive_t **current,
- ap_directive_t **curr_parent,
- char *orig_directive);
+ cmd_parms *parms,
+ ap_directive_t **current,
+ ap_directive_t **curr_parent,
+ char *orig_directive);
/**
* Build a config tree from a config file
* Walk a config tree and setup the server's internal structures
* @param conftree The config tree to walk
* @param parms The cmd_parms to pass to all functions
- * @param config The parms context
+ * @param section_vector The per-section config vector.
* @return Error string on error, NULL otherwise
- * @deffunc const char *ap_walk_config(ap_directive_t *conftree, cmd_parms *parms, void *config)
+ * @deffunc const char *ap_walk_config(ap_directive_t *conftree, cmd_parms *parms, ap_conf_vector_t *section_vector)
*/
AP_DECLARE(const char *) ap_walk_config(ap_directive_t *conftree,
- cmd_parms *parms, void *config);
+ cmd_parms *parms,
+ ap_conf_vector_t *section_vector);
/**
* ap_check_cmd_context() definitions:
* Setup the config vector for per dir module configs
* @param p The pool to allocate the config vector out of
* @return The config vector
- * @deffunc void *ap_create_per_dir_config(apr_pool_t *p)
+ * @deffunc ap_conf_vector_t *ap_create_per_dir_config(apr_pool_t *p)
*/
AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p);
AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod);
/**
- * Add a per_dir and per_server config vector to a given module
- * @param parms The command_parms to use
- * @param config The config vector
- * @param mod The module to add the vector for.
- * @return The new config vector
- * @deffunc void *ap_set_config_vectors(cmd_parms *parms, void *config, module *mod)
- */
-AP_CORE_DECLARE(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod);
+ * Ask a module to create per-server and per-section (dir/loc/file) configs
+ * (if it hasn't happened already). The results are stored in the server's
+ * config, and the specified per-section config vector.
+ * @param server The server to operate upon.
+ * @param section_vector The per-section config vector.
+ * @param section Which section to create a config for.
+ * @param mod The module which is defining the config data.
+ * @param pconf A pool for all configuration allocations.
+ * @return The (new) per-section config data.
+ * @deffunc void *ap_set_config_vectors(server_rec *server, ap_conf_vector_t *section_vector, const char *dir, module *mod, apr_pool_t *pconf)
+ */
+AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server,
+ ap_conf_vector_t *section_vector,
+ const char *section,
+ module *mod, apr_pool_t *pconf);
#endif
int old_overrides = cmd->override;
char *old_path = cmd->path;
core_dir_config *conf;
- void *new_dir_conf = ap_create_per_dir_config(cmd->pool);
+ ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool);
regex_t *r = NULL;
const command_rec *thiscmd = cmd->cmd;
}
/* initialize our config and fetch it */
- conf = (core_dir_config *)ap_set_config_vectors(cmd, new_dir_conf,
- &core_module);
+ conf = ap_set_config_vectors(cmd->server, new_dir_conf, cmd->path,
+ &core_module, cmd->pool);
errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_dir_conf);
if (errmsg != NULL)
core_dir_config *conf;
regex_t *r = NULL;
const command_rec *thiscmd = cmd->cmd;
-
- void *new_url_conf = ap_create_per_dir_config(cmd->pool);
-
+ ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool);
const char *err = ap_check_cmd_context(cmd,
NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
if (err != NULL) {
}
/* initialize our config and fetch it */
- conf = (core_dir_config *)ap_set_config_vectors(cmd, new_url_conf,
- &core_module);
+ conf = ap_set_config_vectors(cmd->server, new_url_conf, cmd->path,
+ &core_module, cmd->pool);
errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_url_conf);
if (errmsg != NULL)
regex_t *r = NULL;
const command_rec *thiscmd = cmd->cmd;
core_dir_config *c=mconfig;
-
- void *new_file_conf = ap_create_per_dir_config(cmd->pool);
-
+ ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool);
const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT|NOT_IN_LOCATION);
+
if (err != NULL) {
return err;
}
}
/* initialize our config and fetch it */
- conf = (core_dir_config *)ap_set_config_vectors(cmd, new_file_conf,
- &core_module);
+ conf = ap_set_config_vectors(cmd->server, new_file_conf, cmd->path,
+ &core_module, cmd->pool);
errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_file_conf);
if (errmsg != NULL)
return NULL;
}
-AP_CORE_DECLARE(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod)
+AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server,
+ ap_conf_vector_t *section_vector,
+ const char *section,
+ module *mod, apr_pool_t *pconf)
{
- ap_conf_vector_t *mconfig = ap_get_module_config(config, mod);
- ap_conf_vector_t *sconfig = ap_get_module_config(parms->server->module_config, mod);
+ void *section_config = ap_get_module_config(section_vector, mod);
+ void *server_config = ap_get_module_config(server->module_config, mod);
- if (!mconfig && mod->create_dir_config) {
- mconfig = (*mod->create_dir_config) (parms->pool, parms->path);
- ap_set_module_config(config, mod, mconfig);
+ if (!section_config && mod->create_dir_config) {
+ /* ### need to fix the create_dir_config functions' prototype... */
+ section_config = (*mod->create_dir_config) (pconf, (char *)section);
+ ap_set_module_config(section_vector, mod, section_config);
}
- if (!sconfig && mod->create_server_config) {
- sconfig = (*mod->create_server_config) (parms->pool, parms->server);
- ap_set_module_config(parms->server->module_config, mod, sconfig);
+ if (!server_config && mod->create_server_config) {
+ server_config = (*mod->create_server_config) (pconf, server);
+ ap_set_module_config(server->module_config, mod, server_config);
}
- return mconfig;
+
+ return section_config;
}
static const char *execute_now(char *cmd_line, const char *args, cmd_parms *parms,
}
static const char *ap_walk_config_sub(const ap_directive_t *current,
- cmd_parms *parms, void *config)
+ cmd_parms *parms,
+ ap_conf_vector_t *section_vector)
{
module *mod = top_module;
NULL);
}
else {
- void *mconfig = ap_set_config_vectors(parms,config, mod);
+ void *dir_config = ap_set_config_vectors(parms->server,
+ section_vector,
+ parms->path,
+ mod,
+ parms->pool);
const char *retval;
- retval = invoke_cmd(cmd, parms, mconfig, current->args);
+ retval = invoke_cmd(cmd, parms, dir_config, current->args);
if (retval == NULL) {
return NULL;
}
}
AP_DECLARE(const char *) ap_walk_config(ap_directive_t *current,
- cmd_parms *parms, void *config)
+ cmd_parms *parms,
+ ap_conf_vector_t *section_vector)
{
- void *oldconfig = parms->context;
+ ap_conf_vector_t *oldconfig = parms->context;
- parms->context = config;
+ parms->context = section_vector;
/* scan through all directives, executing each one */
for (; current != NULL; current = current->next) {
parms->directive = current;
/* actually parse the command and execute the correct function */
- errmsg = ap_walk_config_sub(current, parms, config);
+ errmsg = ap_walk_config_sub(current, parms, section_vector);
if (errmsg != NULL) {
/* restore the context (just in case) */
parms->context = oldconfig;