]> granicus.if.org Git - apache/commitdiff
Merge r1458456 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 15 Apr 2013 12:37:59 +0000 (12:37 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 15 Apr 2013 12:37:59 +0000 (12:37 +0000)
Useful extensions...
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1467975 13f79535-47bb-0310-9956-ffa450edef68

STATUS
include/ap_mmn.h
include/util_filter.h
server/util_filter.c

diff --git a/STATUS b/STATUS
index 11da99eb528b4a049cbf7bc487fb20dbdf2bef70..a1d4fe5d451ff5acd4499e8e566cc8e221230de2 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -90,11 +90,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * util_filter: Add in ap_remove_input|output_filter_byhandle()
-    trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1458456
-    2.4.x patch: trunk patch works modulo ap_mmn.h
-    +1: jim, rjung, covener
-
   * cache_storage: remove useless test + update function name in debug log +
     skip as soon as we know headers do not match
     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1452281
index 63d09952873cfe0bfa9c1a2ead3c5b6b57b9d9f6..351808ac47a036d4b21e317218a374fc6f831ff9 100644 (file)
  * 20120211.9 (2.4.4-dev)  Add fgrab() to ap_slotmem_provider_t.
  * 20120211.10 (2.4.4-dev) Add in bal_persist field to proxy_server_conf
  * 20120211.11 (2.4.4-dev) Add ap_bin2hex()
+ * 20120211.12 (2.4.5-dev)  Add ap_remove_input|output_filter_byhandle()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20120211
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 11                   /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 12                   /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index 8b3c7a848703ac9efc497c95837d4ec65a0ea20c..5a966074ff862537c63a5acc9c8535b463e68370 100644 (file)
@@ -486,6 +486,25 @@ AP_DECLARE(void) ap_remove_input_filter(ap_filter_t *f);
 
 AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f);
 
+/**
+ * Remove an input filter from either the request or connection stack
+ * it is associated with.
+ * @param next   The filter stack to search
+ * @param handle The filter handle (name) to remove
+ * @return APR_SUCCESS on removal or error
+ */
+AP_DECLARE(apr_status_t) ap_remove_input_filter_byhandle(ap_filter_t *next,
+                                                         const char *handle);
+/**
+ * Remove an output filter from either the request or connection stack
+ * it is associated with.
+ * @param next   The filter stack to search
+ * @param handle The filter handle (name) to remove
+ * @return APR_SUCCESS on removal or error
+ */
+AP_DECLARE(apr_status_t) ap_remove_output_filter_byhandle(ap_filter_t *next,
+                                                          const char *handle);
+
 /* 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
  * want to change our filter registration method.  The basic idea, is that
index 7121eced9e68e21c3f9e2f5b749886c82fcd4c2a..01eb533520470eb65962c5c7b0923b0da9996f13 100644 (file)
@@ -479,6 +479,63 @@ AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f)
                       &f->c->output_filters);
 }
 
+AP_DECLARE(apr_status_t) ap_remove_input_filter_byhandle(ap_filter_t *next,
+                                                         const char *handle)
+{
+    ap_filter_t *found = NULL;
+    ap_filter_rec_t *filter;
+
+    if (!handle) {
+        return APR_EINVAL;
+    }
+    filter = ap_get_input_filter_handle(handle);
+    if (!filter) {
+        return APR_NOTFOUND;
+    }
+
+    while (next) {
+        if (next->frec == filter) {
+            found = next;
+            break;
+        }
+        next = next->next;
+    }
+    if (found) {
+        ap_remove_input_filter(found);
+        return APR_SUCCESS;
+    }
+    return APR_NOTFOUND;
+}
+
+AP_DECLARE(apr_status_t) ap_remove_output_filter_byhandle(ap_filter_t *next,
+                                                          const char *handle)
+{
+    ap_filter_t *found = NULL;
+    ap_filter_rec_t *filter;
+
+    if (!handle) {
+        return APR_EINVAL;
+    }
+    filter = ap_get_output_filter_handle(handle);
+    if (!filter) {
+        return APR_NOTFOUND;
+    }
+
+    while (next) {
+        if (next->frec == filter) {
+            found = next;
+            break;
+        }
+        next = next->next;
+    }
+    if (found) {
+        ap_remove_output_filter(found);
+        return APR_SUCCESS;
+    }
+    return APR_NOTFOUND;
+}
+
+
 /*
  * Read data from the next filter in the filter stack.  Data should be
  * modified in the bucket brigade that is passed in.  The core allocates the