]> granicus.if.org Git - apache/commitdiff
Fix filter registration so that the appropriate list of
authorJeff Trawick <trawick@apache.org>
Tue, 19 Sep 2000 23:28:55 +0000 (23:28 +0000)
committerJeff Trawick <trawick@apache.org>
Tue, 19 Sep 2000 23:28:55 +0000 (23:28 +0000)
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
server/util_filter.c

index 03ca49cf941f86fe8ce9307aff33fa28748c067f..2f0567203ae530c2e7045bc05d32af4a5f5097a9 100644 (file)
@@ -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
index 69b4779e18bb4196dbb8f4dd8fbf9c9c368c6b94..1e5d6eb636b1882f28691c10cc24bcd2d2faa829 100644 (file)
@@ -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, 
+                    &registered_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, 
+                    &registered_output_filters);
 }
 
 API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r)