From f8453ca3af9a783d9193b7e8900a0eb5e1ecef77 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Tue, 19 Sep 2000 23:28:55 +0000 Subject: [PATCH] Fix filter registration so that the appropriate list of registrations is actually modified. This allows Apache to server pages again. (Before this, every ap_add_filter() silently failed and so output content went to the bit bucket.) Also, repair some comments and un-namespace-protect a now-static function. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86255 13f79535-47bb-0310-9956-ffa450edef68 --- include/util_filter.h | 24 ++++++++++++++++++------ server/util_filter.c | 28 ++++++++++++++-------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/include/util_filter.h b/include/util_filter.h index 03ca49cf94..2f0567203a 100644 --- a/include/util_filter.h +++ b/include/util_filter.h @@ -113,8 +113,9 @@ typedef struct ap_filter_t ap_filter_t; * receiving its own per-install context pointer. * * Callbacks are associated with a filter definition, which is specified - * by name. See ap_register_filter() for setting the association between - * a name for a filter and its associated callback (and other information). + * by name. See ap_register_input_filter() and ap_register_output_filter() + * for setting the association between a name for a filter and its + * associated callback (and other information). * * The *bucket structure (and all those referenced by ->next and ->prev) * should be considered "const". The filter is allowed to modify the @@ -241,11 +242,12 @@ struct ap_filter_t { API_EXPORT(apr_status_t) ap_pass_brigade(ap_filter_t *filter, ap_bucket_brigade *bucket); /* - * ap_register_filter(): + * ap_register_input_filter(): * - * This function is used to register a filter with the system. After this - * registration is performed, then a filter may be added into the filter - * chain by using ap_add_filter() and simply specifying the name. + * This function is used to register an input filter with the system. + * After this registration is performed, then a filter may be added + * into the filter chain by using ap_add_filter() and simply specifying + * the name. * * The filter's callback and type should be passed. */ @@ -260,6 +262,16 @@ API_EXPORT(apr_status_t) ap_pass_brigade(ap_filter_t *filter, ap_bucket_brigade API_EXPORT(void) ap_register_input_filter(const char *name, ap_filter_func filter_func, ap_filter_type ftype); +/* + * ap_register_output_filter(): + * + * This function is used to register an output filter with the system. + * After this registration is performed, then a filter may be added + * into the filter chain by using ap_add_filter() and simply specifying + * the name. + * + * The filter's callback and type should be passed. + */ /** * Register an output filter for later use. This allows modules to name their * filter functions for later addition to a specific request diff --git a/server/util_filter.c b/server/util_filter.c index 69b4779e18..1e5d6eb636 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -85,10 +85,10 @@ static apr_status_t filter_cleanup(void *ctx) return APR_SUCCESS; } -static void ap_register_filter(const char *name, - ap_filter_func filter_func, - ap_filter_type ftype, - ap_filter_rec_t *reg_filter_list) +static void 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)); @@ -96,26 +96,26 @@ static void ap_register_filter(const char *name, frec->filter_func = filter_func; frec->ftype = ftype; - frec->next = reg_filter_list; - reg_filter_list = 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_filter_func filter_func, + ap_filter_type ftype) { - ap_register_filter(name, filter_func, ftype, - registered_input_filters); + register_filter(name, filter_func, ftype, + ®istered_input_filters); } API_EXPORT(void) ap_register_output_filter(const char *name, - ap_filter_func filter_func, - ap_filter_type ftype) + ap_filter_func filter_func, + ap_filter_type ftype) { - ap_register_filter(name, filter_func, ftype, - registered_output_filters); + register_filter(name, filter_func, ftype, + ®istered_output_filters); } API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r) -- 2.40.0