]> granicus.if.org Git - apache/commitdiff
stash the brigade used by send_bucket_downstream in the filter context for
authorGreg Ames <gregames@apache.org>
Tue, 9 Sep 2008 18:59:40 +0000 (18:59 +0000)
committerGreg Ames <gregames@apache.org>
Tue, 9 Sep 2008 18:59:40 +0000 (18:59 +0000)
reuse.

Submitted by: Dan Poirier <poirier pobox.com>

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

modules/filters/mod_charset_lite.c

index dda44bf6bef7dc8c595d42fc47064936da548a44..f4094c94947f89acf1791ea4705a063c1e05bb67 100644 (file)
@@ -96,6 +96,7 @@ typedef struct charset_filter_ctx_t {
     int noop;               /* should we pass brigades through unchanged? */
     char *tmp;              /* buffer for input filtering */
     apr_bucket_brigade *bb; /* input buckets we couldn't finish translating */
+    apr_bucket_brigade *tmpbb; /* used for passing downstream */
 } charset_filter_ctx_t;
 
 /* charset_req_t is available via r->request_config if any translation is
@@ -266,6 +267,8 @@ static int find_code_page(request_rec *r)
 
     reqinfo->dc = dc;
     output_ctx->dc = dc;
+    output_ctx->tmpbb = apr_brigade_create(r->pool, 
+                                           r->connection->bucket_alloc);
     ap_set_module_config(r->request_config, &charset_lite_module, reqinfo);
 
     reqinfo->output_ctx = output_ctx;
@@ -416,18 +419,15 @@ static apr_status_t send_eos(ap_filter_t *f)
 
 static apr_status_t send_bucket_downstream(ap_filter_t *f, apr_bucket *b)
 {
-    request_rec *r = f->r;
-    conn_rec *c = r->connection;
-    apr_bucket_brigade *bb;
     charset_filter_ctx_t *ctx = f->ctx;
     apr_status_t rv;
 
-    bb = apr_brigade_create(r->pool, c->bucket_alloc);
-    APR_BRIGADE_INSERT_TAIL(bb, b);
-    rv = ap_pass_brigade(f->next, bb);
+    APR_BRIGADE_INSERT_TAIL(ctx->tmpbb, b);
+    rv = ap_pass_brigade(f->next, ctx->tmpbb);
     if (rv != APR_SUCCESS) {
         ctx->ees = EES_DOWNSTREAM;
     }
+    apr_brigade_cleanup(ctx->tmpbb);
     return rv;
 }