summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2017-02-14 23:51:54 +0100
committerYann Ylavic <ylavic@apache.org>2017-02-14 23:51:54 +0100
commit283f8c828a7bd2359af20be7700cd6d6cd98a97b (patch)
tree678d2fc1e27a4c55d564a563b0c09ac7d74fd5e8 /modules
parentdefault_handler: cleanup outputed brigade before leaving. (diff)
downloadapache2-283f8c828a7bd2359af20be7700cd6d6cd98a97b.tar.xz
apache2-283f8c828a7bd2359af20be7700cd6d6cd98a97b.zip
mod_bucketeer: consume given brigade while forwarding/setting aside.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783045 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r--modules/debugging/mod_bucketeer.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/modules/debugging/mod_bucketeer.c b/modules/debugging/mod_bucketeer.c
index 2b10cd5b00..ac9154a0a9 100644
--- a/modules/debugging/mod_bucketeer.c
+++ b/modules/debugging/mod_bucketeer.c
@@ -65,6 +65,7 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
request_rec *r = f->r;
bucketeer_ctx_t *ctx = f->ctx;
bucketeer_filter_config_t *c;
+ apr_status_t rv;
c = ap_get_module_config(r->server->module_config, &bucketeer_module);
@@ -81,13 +82,12 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
apr_table_unset(f->r->headers_out, "Content-Length");
}
- for (e = APR_BRIGADE_FIRST(bb);
- e != APR_BRIGADE_SENTINEL(bb);
- e = APR_BUCKET_NEXT(e))
- {
+ while (!APR_BRIGADE_EMPTY(bb)) {
const char *data;
apr_size_t len, i, lastpos;
+ e = APR_BRIGADE_FIRST(bb);
+
if (APR_BUCKET_IS_EOS(e)) {
APR_BUCKET_REMOVE(e);
APR_BRIGADE_INSERT_TAIL(ctx->bb, e);
@@ -96,7 +96,9 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
* Time to pass it along down the chain.
*/
ap_remove_output_filter(f);
- return ap_pass_brigade(f->next, ctx->bb);
+ rv = ap_pass_brigade(f->next, ctx->bb);
+ apr_brigade_cleanup(ctx->bb);
+ return rv;
}
if (APR_BUCKET_IS_FLUSH(e)) {
@@ -104,14 +106,15 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
* Ignore flush buckets for the moment..
* we decide what to stream
*/
+ apr_bucket_delete(e);
continue;
}
if (APR_BUCKET_IS_METADATA(e)) {
/* metadata bucket */
- apr_bucket *cpy;
- apr_bucket_copy(e, &cpy);
- APR_BRIGADE_INSERT_TAIL(ctx->bb, cpy);
+ APR_BUCKET_REMOVE(e);
+ apr_bucket_setaside(e, f->r->pool);
+ APR_BRIGADE_INSERT_TAIL(ctx->bb, e);
continue;
}
@@ -140,8 +143,6 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
APR_BRIGADE_INSERT_TAIL(ctx->bb, p);
}
if (data[i] == c->passdelimiter) {
- apr_status_t rv;
-
rv = ap_pass_brigade(f->next, ctx->bb);
if (rv) {
return rv;
@@ -163,6 +164,8 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
APR_BRIGADE_INSERT_TAIL(ctx->bb, p);
}
}
+
+ apr_bucket_delete(e);
}
return APR_SUCCESS;