]> granicus.if.org Git - apache/commitdiff
Further to r599711; document new API guarantee for handling non-NULL
authorJoe Orton <jorton@apache.org>
Mon, 3 Dec 2007 10:55:58 +0000 (10:55 +0000)
committerJoe Orton <jorton@apache.org>
Mon, 3 Dec 2007 10:55:58 +0000 (10:55 +0000)
request_rec pointer when adding connection filters; minor MMN bump:

* server/util_filter.c (add_any_filter_handle): Set f->r for
  connection filters even if passed-in r is non-NULL.  Style nit fix
  also.

* include/util_filter.h (ap_add_output_filter,
  ap_add_output_filter_handle): Document new API guarantee.

* include/ap_mmn.h: Minor MMN bump.

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

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

index d98cc2993b3c366f5414db1be03c488603bba7a2..6238a84c41d2e86ee849bca402cbc67c32411def 100644 (file)
  *                         public scoreboard API.
  * 20071108.1 (2.3.0-dev)  Add the optional kept_body brigade to request_rec
  * 20071108.2 (2.3.0-dev)  Add st and keep fields to struct util_ldap_connection_t
+ * 20071108.3 (2.3.0-dev)  Add API guarantee for adding connection filters
+ *                         with non-NULL request_rec pointer (ap_add_*_filter*)
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20071108
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 2                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 3                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index c17ae41c48760239f1e7c9b93b0172466d45ae31..2355c251922f677210aae5aade52cd9965ed7f0c 100644 (file)
@@ -411,6 +411,10 @@ AP_DECLARE(ap_filter_rec_t *) ap_get_input_filter_handle(const char *name);
  * @param ctx Context data to set in the filter
  * @param r The request to add this filter for (or NULL if it isn't associated with a request)
  * @param c The connection to add this filter for
+ * @note If adding a connection-level output filter (i.e. where the type
+ * is >= AP_FTYPE_CONNECTION) during processing of a request, the request
+ * object r must be passed in to ensure the filter chains are modified
+ * correctly.  f->r will still be initialized as NULL in the new filter.
  */
 AP_DECLARE(ap_filter_t *) ap_add_output_filter(const char *name, void *ctx, 
                                                request_rec *r, conn_rec *c);
@@ -421,7 +425,11 @@ AP_DECLARE(ap_filter_t *) ap_add_output_filter(const char *name, void *ctx,
  *
  * @param f The filter handle to add
  * @param r The request to add this filter for (or NULL if it isn't associated with a request)
- * @param c The connection to add the fillter for
+ * @param c The connection to add the filter for
+ * @note If adding a connection-level output filter (i.e. where the type
+ * is >= AP_FTYPE_CONNECTION) during processing of a request, the request
+ * object r must be passed in to ensure the filter chains are modified
+ * correctly.  f->r will still be initialized as NULL in the new filter.
  */
 AP_DECLARE(ap_filter_t *) ap_add_output_filter_handle(ap_filter_rec_t *f,
                                                       void *ctx,
index 636b601d9faa1ea348185cb9fad36b4d5ec5a101..f2e5b5d29990b56b1df0c9e629b8b0f9cee95e71 100644 (file)
@@ -279,7 +279,7 @@ static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx,
                                           ap_filter_t **p_filters,
                                           ap_filter_t **c_filters)
 {
-    apr_pool_tp = frec->ftype < AP_FTYPE_CONNECTION && r ? r->pool : c->pool;
+    apr_pool_t *p = frec->ftype < AP_FTYPE_CONNECTION && r ? r->pool : c->pool;
     ap_filter_t *f = apr_palloc(p, sizeof(*f));
     ap_filter_t **outf;
 
@@ -309,7 +309,8 @@ static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx,
 
     f->frec = frec;
     f->ctx = ctx;
-    f->r = r;
+    /* f->r must always be NULL for connection filters */
+    f->r = frec->ftype < AP_FTYPE_CONNECTION ? r : NULL;
     f->c = c;
     f->next = NULL;