]> granicus.if.org Git - apache/commitdiff
Back out the change to move the core_output_filters brigade to the
authorRyan Bloom <rbb@apache.org>
Tue, 10 Oct 2000 03:35:11 +0000 (03:35 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 10 Oct 2000 03:35:11 +0000 (03:35 +0000)
conn_rec.  Since all requests on a given connection use the same
core_output_filter, the ctx in that filter has the correct lifetime

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

include/httpd.h
modules/http/http_core.c

index 6a8d6f4e3c4015ca64420710c54183d69c0c8cf2..993e45c583467c1816ea92e64db79a7db4ed1143 100644 (file)
@@ -910,9 +910,6 @@ struct conn_rec {
     /** A list of output filters to be used for this connection
      *  @defvar ap_filter_t *filters */
     struct ap_filter_t *output_filters;
-    /** Location to store data about to be written to the client.
-     *  @defvar ap_bucket_brigade *client_data */
-    struct ap_bucket_brigade *client_data;
     /** bytes left to read in the current request body */
     long remaining;
 };
index d591fdb986e3146b3cd214ffa01535d3325d927e..cebf978d4e51aac78c6c1e0c4fd5750821ef47bc 100644 (file)
@@ -3340,6 +3340,9 @@ static int core_input_filter(ap_filter_t *f, ap_bucket_brigade *b)
  * is to send the headers if they haven't already been sent, and then send
  * the actual data.
  */
+typedef struct CORE_OUTPUT_FILTER_CTX {
+    ap_bucket_brigade *b;
+} core_output_filter_ctx_t;
 #define MAX_IOVEC_TO_WRITE 16
 static int core_output_filter(ap_filter_t *f, ap_bucket_brigade *b)
 {
@@ -3348,6 +3351,7 @@ static int core_output_filter(ap_filter_t *f, ap_bucket_brigade *b)
     apr_ssize_t bytes_sent = 0, nbytes;
     ap_bucket *e;
     conn_rec *c = f->c;
+    core_output_filter_ctx_t *ctx = f->ctx;
 
     apr_ssize_t nvec = 0;
     apr_ssize_t nvec_trailers= 0;
@@ -3358,11 +3362,14 @@ static int core_output_filter(ap_filter_t *f, ap_bucket_brigade *b)
     apr_ssize_t flen = 0;
     apr_off_t foffset = 0;
 
+    if (ctx == NULL) {
+        f->ctx = ctx = apr_pcalloc(c->pool, sizeof(core_output_filter_ctx_t));
+    }
     /* If we have a saved brigade, concatenate the new brigade to it */
-    if (c->client_data) {
-        AP_BRIGADE_CONCAT(c->client_data, b);
-        b = c->client_data;
-        c->client_data = NULL;
+    if (ctx->b) {
+        AP_BRIGADE_CONCAT(ctx->b, b);
+        b = ctx->b;
+        ctx->b = NULL;
     }
 
     /* Hijack any bytes in BUFF and prepend it to the brigade. */
@@ -3420,7 +3427,7 @@ static int core_output_filter(ap_filter_t *f, ap_bucket_brigade *b)
          * buffer the brigade or send the brigade out on the network
          */
         if (!fd && (!more) && (nbytes < MIN_SIZE_TO_WRITE) && (e->type != AP_BUCKET_EOS)) {
-            ap_save_brigade(f, &c->client_data, &b);
+            ap_save_brigade(f, &ctx->b, &b);
             return APR_SUCCESS;
         }
         if (fd) {