]> granicus.if.org Git - apache/commitdiff
reversing the latest commit; it was vetoed a while back.
authorGreg Stein <gstein@apache.org>
Wed, 30 Aug 2000 01:09:09 +0000 (01:09 +0000)
committerGreg Stein <gstein@apache.org>
Wed, 30 Aug 2000 01:09:09 +0000 (01:09 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86162 13f79535-47bb-0310-9956-ffa450edef68

include/util_filter.h
modules/http/http_core.c
modules/http/http_protocol.c
server/util_filter.c

index a5d100f11235968aa5d4a4efe39567be3d614325..2ce9eeac19dbb5238827b015358d723796a52ec9 100644 (file)
@@ -255,24 +255,18 @@ API_EXPORT(void) ap_register_filter(const char *name,
  * from another request, then this filter will be added before those other
  * filters.
  * 
- * To re-iterate that last comment.  This function is building a LIFO
+ * To re-iterate that last comment.  This function is building a FIFO
  * list of filters.  Take note of that when adding your filter to the chain.
  */
 /**
- * Add a filter to the current request.  Filters are added in a LIFO manner.
- * The first filter added will be the last filter called.
+ * Add a filter to the current request.  Filters are added in a FIFO manner.
+ * The first filter added will be the first filter called.
  * @param name The name of the filter to add
  * @param ctx Any filter specific data to associate with the filter
  * @param r The request to add this filter for.
- * @param curr The filter to add this filter after.  This is incredibly useful
- *             if you are adding a filter while executing another filter.  The
- *             new filter should be added immediately after the current filter.
- *             By passing the current filter into ap_add_filter, this is
- *             accomplished easily.
- * @deffunc void ap_add_filter(const char *name, void *ctx, request_rec *r, ap_filter_t *curr)
+ * @deffunc void ap_add_filter(const char *name, void *ctx, request_rec *r)
  */
-API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r,
-                               ap_filter_t *curr);
+API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r);
 
 /* 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
index 72b5dffca96f28098576a8f4fddb1c686cb31ce5..041f5f863316b453da022f05f904f71a5762a166 100644 (file)
@@ -3089,7 +3089,7 @@ static unsigned short core_port(const request_rec *r)
 
 static void core_register_filter(request_rec *r)
 {
-    ap_add_filter("CORE", NULL, r, NULL);
+    ap_add_filter("CORE", NULL, r);
 }
 
 static void register_hooks(void)
@@ -3109,7 +3109,7 @@ 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);
+    ap_register_filter("CORE", core_filter, AP_FTYPE_CONNECTION + 1);
     ap_register_filter("CHUNK", chunk_filter, AP_FTYPE_CONNECTION);
 }
 
index 4d6991247091161a307bd4c07e57d717d4085edc..d74516814c0de4a27ee1df4186c9ddf67529b177 100644 (file)
@@ -1862,7 +1862,7 @@ API_EXPORT(void) ap_send_http_header(request_rec *r)
     if (r->chunked) {
         apr_table_mergen(r->headers_out, "Transfer-Encoding", "chunked");
         apr_table_unset(r->headers_out, "Content-Length");
-        ap_add_filter("CHUNK", NULL, r, NULL);
+        ap_add_filter("CHUNK", NULL, r);
     }
 
     if (r->byterange > 1)
index 29abc84018b4001d0c462a11886af7aa57a44fc9..491a52b379429fa23b18016bb02706d6b09f7837 100644 (file)
@@ -117,8 +117,7 @@ API_EXPORT(void) ap_register_filter(const char *name,
     apr_register_cleanup(FILTER_POOL, NULL, filter_cleanup, apr_null_cleanup);
 }
 
-API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r,
-                               ap_filter_t *curr)
+API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r)
 {
     ap_filter_rec_t *frec = registered_filters;
 
@@ -131,14 +130,18 @@ API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r,
             f->ftype = frec->ftype;
             f->r = r;
 
-            if (curr) {
-                f->next = curr->next;
-                curr->next = f;
-            }
-            else {
+            if (INSERT_BEFORE(f, r->filters)) {
                 f->next = r->filters;
                 r->filters = f;
             }
+            else {
+                ap_filter_t *fscan = r->filters;
+                while (!INSERT_BEFORE(f, fscan->next))
+                    fscan = fscan->next;
+                f->next = fscan->next;
+                fscan->next = f;
+            }
+
             break;
         }
     }