* Add a filter to the current request. Filters are added in a FIFO manner.
* The first filter added will be the first filter called.
* @param name The name of the filter to add
- * @param ctx Any filter specific data to associate with the filter
* @param r The request to add this filter for.
- * @deffunc void ap_add_filter(const char *name, void *ctx, request_rec *r)
+ * @deffunc void ap_add_filter(const char *name, request_rec *r)
*/
-API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r);
+API_EXPORT(void) ap_add_filter(const char *name, request_rec *r);
/* The next two filters are for abstraction purposes only. They could be
* done away with, but that would require that we break modules if we ever
conf->add_default_charset = ADD_DEFAULT_CHARSET_UNSET;
conf->add_default_charset_name = DEFAULT_ADD_DEFAULT_CHARSET_NAME;
+ conf->filters = apr_make_array(a, 40, sizeof(void *));
return (void *)conf;
}
conf->add_default_charset_name = new->add_default_charset_name;
}
}
+ conf->filters = apr_append_arrays(a, base->filters, new->filters);
return (void*)conf;
}
return NULL;
}
+static const char *add_filter(cmd_parms *cmd, void *dummy, const char *arg)
+{
+ core_dir_config *conf = dummy;
+ char **newfilter;
+
+ newfilter = (char **)apr_push_array(conf->filters);
+ *newfilter = apr_pstrdup(cmd->pool, arg);
+ return NULL;
+}
+
static const char *add_module_command(cmd_parms *cmd, void *dummy,
const char *arg)
{
AP_INIT_TAKE12("RLimitNPROC", no_set_limit, NULL,
OR_ALL, "soft/hard limits for max number of processes per uid"),
#endif
+/* XXX This should be allowable in .htaccess files, but currently it won't
+ * play well with the Options stuff. Until that is fixed, I would prefer
+ * to leave it just in the conf file. Other should feel free to disagree
+ * with me. Rbb.
+ */
+AP_INIT_ITERATE("AddFilter", add_filter, NULL, ACCESS_CONF,
+ "filters to be run"),
{ NULL }
};
static void core_register_filter(request_rec *r)
{
- ap_add_filter("CORE", NULL, r);
+ int i;
+ core_dir_config *conf = (core_dir_config *)
+ ap_get_module_config(r->per_dir_config,
+ &core_module);
+ char **items = (char **)conf->filters->elts;
+
+ for (i = 0; i < conf->filters->nelts; i++) {
+ char *foobar = items[i];
+ ap_add_filter(foobar, r);
+ }
+
+ ap_add_filter("CORE", r);
}
static void register_hooks(void)
apr_register_cleanup(FILTER_POOL, NULL, filter_cleanup, apr_null_cleanup);
}
-API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r)
+API_EXPORT(void) ap_add_filter(const char *name, request_rec *r)
{
ap_filter_rec_t *frec = registered_filters;
ap_filter_t *f = apr_pcalloc(r->pool, sizeof(*f));
f->filter_func = frec->filter_func;
- f->ctx = ctx;
+ f->ctx = NULL;
f->ftype = frec->ftype;
f->r = r;