/** A flag to determine if the eos bucket has been sent yet
* @defvar int eos_sent */
int eos_sent;
- /** A list of output filters to be used for this request
- * @defvar ap_filter_t *filters */
- struct ap_filter_t *input_filters;
/* Things placed at the end of the record to avoid breaking binary
* compatibility. It would be nice to remember to reorder the entire
/** send note from one module to another, must remain valid for all
* requests on this conn */
apr_table_t *notes;
+ /** A list of input filters to be used for this request
+ * @defvar ap_filter_t *filters */
+ struct ap_filter_t *input_filters;
};
/* Per-vhost config... */
* The filter's callback and type should be passed.
*/
/**
- * Register a filter for later use. This allows modules to name their filter
- * functions for later addition to a specific request
+ * Register an input filter for later use. This allows modules to name their
+ * filter functions for later addition to a specific request
* @param name The name to attach to the filter function
* @param filter_func The filter function to name
* @param The type of filter function, either AP_FTYPE_CONTENT or AP_FTYPE_CONNECTION
- * @deffunc void ap_register_filter(const char *name, ap_filter_func filter_func, ap_filter_type ftype)
+ * @deffunc void ap_register_input_filter(const char *name, ap_filter_func filter_func, ap_filter_type ftype)
*/
-API_EXPORT(void) ap_register_filter(const char *name,
- ap_filter_func filter_func,
- ap_filter_type ftype);
+API_EXPORT(void) ap_register_input_filter(const char *name,
+ ap_filter_func filter_func,
+ ap_filter_type ftype);
+/**
+ * Register an output filter for later use. This allows modules to name their
+ * filter functions for later addition to a specific request
+ * @param name The name to attach to the filter function
+ * @param filter_func The filter function to name
+ * @param The type of filter function, either AP_FTYPE_CONTENT or AP_FTYPE_CONNECTION
+ * @deffunc void ap_register_output_filter(const char *name, ap_filter_func filter_func, ap_filter_type ftype)
+ */
+API_EXPORT(void) ap_register_output_filter(const char *name,
+ ap_filter_func filter_func,
+ ap_filter_type ftype);
/*
* ap_add_filter():
{
ap_hook_fixups(find_code_page, NULL, NULL, AP_HOOK_MIDDLE);
ap_hook_insert_filter(xlate_insert_filter, NULL, NULL, AP_HOOK_MIDDLE);
- ap_register_filter(XLATEOUT_FILTER_NAME, xlate_filter, AP_FTYPE_CONTENT);
+ ap_register_output_filter(XLATEOUT_FILTER_NAME, xlate_filter, AP_FTYPE_CONTENT);
}
module charset_lite_module =
static void register_hooks(void)
{
- ap_register_filter("INCLUDES", includes_filter, AP_FTYPE_CONTENT);
+ ap_register_output_filter("INCLUDES", includes_filter, AP_FTYPE_CONTENT);
}
module MODULE_VAR_EXPORT includes_module =
* request-processing time.
*/
ap_hook_insert_filter(core_register_filter, NULL, NULL, AP_HOOK_MIDDLE);
- ap_register_filter("CORE", core_filter, AP_FTYPE_CONNECTION + 1);
- ap_register_filter("CHUNK", chunk_filter, AP_FTYPE_CONNECTION);
+ ap_register_output_filter("CORE", core_filter, AP_FTYPE_CONNECTION + 1);
+ ap_register_output_filter("CHUNK", chunk_filter, AP_FTYPE_CONNECTION);
}
API_VAR_EXPORT module core_module = {
/* ### make this visible for direct manipulation?
* ### use a hash table
*/
-static ap_filter_rec_t *registered_filters = NULL;
+static ap_filter_rec_t *registered_output_filters = NULL;
+static ap_filter_rec_t *registered_input_filters = NULL;
/* NOTE: Apache's current design doesn't allow a pool to be passed thu,
so we depend on a global to hold the correct pool
static apr_status_t filter_cleanup(void *ctx)
{
- registered_filters = NULL;
+ registered_output_filters = NULL;
+ registered_input_filters = NULL;
return APR_SUCCESS;
}
-API_EXPORT(void) ap_register_filter(const char *name,
- ap_filter_func filter_func,
- ap_filter_type ftype)
+static void ap_register_filter(const char *name,
+ ap_filter_func filter_func,
+ ap_filter_type ftype,
+ ap_filter_rec_t *reg_filter_list)
{
ap_filter_rec_t *frec = apr_palloc(FILTER_POOL, sizeof(*frec));
frec->filter_func = filter_func;
frec->ftype = ftype;
- frec->next = registered_filters;
- registered_filters = frec;
+ frec->next = reg_filter_list;
+ reg_filter_list = frec;
apr_register_cleanup(FILTER_POOL, NULL, filter_cleanup, apr_null_cleanup);
}
+API_EXPORT(void) ap_register_input_filter(const char *name,
+ ap_filter_func filter_func,
+ ap_filter_type ftype)
+{
+ ap_register_filter(name, filter_func, ftype,
+ registered_input_filters);
+}
+
+API_EXPORT(void) ap_register_output_filter(const char *name,
+ ap_filter_func filter_func,
+ ap_filter_type ftype)
+{
+ ap_register_filter(name, filter_func, ftype,
+ registered_output_filters);
+}
+
API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r)
{
- ap_filter_rec_t *frec = registered_filters;
+ ap_filter_rec_t *frec = registered_output_filters;
for (; frec != NULL; frec = frec->next) {
if (!strcasecmp(name, frec->name)) {