]> granicus.if.org Git - apache/commitdiff
Add a way to remove output filters. This is used by http_header_filter to
authorRyan Bloom <rbb@apache.org>
Sat, 21 Oct 2000 17:22:28 +0000 (17:22 +0000)
committerRyan Bloom <rbb@apache.org>
Sat, 21 Oct 2000 17:22:28 +0000 (17:22 +0000)
remove itself once it has actually sent the headers.

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

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

index edcc4eb636abb3bbbbe089c065231bc95c90f5bc..7c6489559d31f311ded63132fada6a0cc04e3461 100644 (file)
@@ -360,6 +360,8 @@ AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx, request_rec *r
 AP_DECLARE(void) ap_add_output_filter(const char *name, void *ctx, 
                                       request_rec *r, conn_rec *c);
 
+AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f);
+
 /* 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 0a1f0ee7708b1cab9f07b8695cb08c71ae692986..e2dfc84bd787664f69ffaa0d903c90f327fb6c34 100644 (file)
@@ -2228,11 +2228,6 @@ AP_CORE_DECLARE(int) ap_http_header_filter(ap_filter_t *f, ap_bucket_brigade *b)
     char *date = NULL;
     request_rec *r = f->r;
 
-    if ((int)f->ctx != 0) {
-        return ap_pass_brigade(f->next, b);
-    }
-    (int)f->ctx++;
-
     if (r->assbackwards) {
         if (!r->main)
             ap_bsetopt(r->connection->client, BO_BYTECT, &zero);
@@ -2325,6 +2320,7 @@ AP_CORE_DECLARE(int) ap_http_header_filter(ap_filter_t *f, ap_bucket_brigade *b)
     if (r->chunked) {
         ap_bsetflag(r->connection->client, B_CHUNK, 1);
     }
+    ap_remove_output_filter(f);
     return ap_pass_brigade(f->next, b);
 }
 
index 85780a04f61d36cf9452279ef9fd87b8c37085f1..dcd7c06a29ae0f099d828c2921e75b760baebd57 100644 (file)
@@ -155,6 +155,31 @@ AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx,
     }
 }
 
+AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f)
+{
+    ap_filter_t *curr;
+
+    curr = f->r ? f->r->output_filters : f->c->output_filters;
+
+    if (curr == f) {
+        if (f->r) {
+            f->r->output_filters = f->r->output_filters->next;
+        }
+        else {
+            f->c->output_filters = f->c->output_filters->next;
+        }
+        return;
+    }
+
+    while (curr->next != f) {
+        if (curr == NULL) {
+            return;
+        }
+        curr = curr->next;
+    }
+    curr->next = f->next ? f->next : NULL;
+}
+
 AP_DECLARE(void) ap_add_output_filter(const char *name, void *ctx, 
                                       request_rec *r, conn_rec *c)
 {