1
0
mirror of https://github.com/apache/httpd.git synced 2025-07-30 20:03:10 +03:00

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
This commit is contained in:
Yann Ylavic
2017-02-14 22:51:54 +00:00
parent 67e267e0e2
commit 283f8c828a

View File

@ -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;