]> granicus.if.org Git - apache/commitdiff
tart getting things setup for input filtering. All this basically does
authorRyan Bloom <rbb@apache.org>
Tue, 19 Sep 2000 20:56:09 +0000 (20:56 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 19 Sep 2000 20:56:09 +0000 (20:56 +0000)
is add part of the infrastructure.  Namely:

1) filter list in the conn_rec, which is where the input filter list
   must live

2) Split the register_filter into multiple functions, one to register
   input filters the other to register output filters.

3) Modify existing modules so they still work.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86251 13f79535-47bb-0310-9956-ffa450edef68

include/httpd.h
include/util_filter.h
modules/experimental/mod_charset_lite.c
modules/filters/mod_include.c
modules/http/http_core.c
server/util_filter.c

index 73eb089e6a07b84fda57cce58f618120b0eac798..c422b01da68f836314be2e4a1872f2e5ee0c0394 100644 (file)
@@ -814,9 +814,6 @@ struct request_rec {
     /** 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
@@ -881,6 +878,9 @@ struct conn_rec {
     /** 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... */
index 0f73772f0f48e1403a21aa2ea90c7d9115ee6d80..03ca49cf941f86fe8ce9307aff33fa28748c067f 100644 (file)
@@ -250,16 +250,27 @@ API_EXPORT(apr_status_t) ap_pass_brigade(ap_filter_t *filter, ap_bucket_brigade
  * 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():
index 4dd5d4d21d235dcd1d36d6a104fd06af8254dad5..259852d8829a463f56bddf1cdd31b42c65b74c9d 100644 (file)
@@ -703,7 +703,7 @@ static void charset_register_hooks(void)
 {
     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 =
index ec7e82dbbb04f83624c79640de02f6ce640316f5..bcabe9a7d33f283ac08b4e4f58924e6fba482145 100644 (file)
@@ -2542,7 +2542,7 @@ static const command_rec includes_cmds[] =
 
 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 =
index 63082553ec4de0114e3d1bbe3706ea11ee55629a..499bdc88445a497f7e9b9616dd8f0db7c940fad3 100644 (file)
@@ -3167,8 +3167,8 @@ static void register_hooks(void)
      * 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 = {
index 6fbd18368a95725def3efe3f4d0b25d5622762fd..69b4779e18bb4196dbb8f4dd8fbf9c9c368c6b94 100644 (file)
@@ -58,7 +58,8 @@
 /* ### 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
@@ -79,13 +80,15 @@ static ap_filter_rec_t *registered_filters = NULL;
 
 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));
 
@@ -93,15 +96,31 @@ API_EXPORT(void) ap_register_filter(const char *name,
     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)) {