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:
@ -65,6 +65,7 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
|
|||||||
request_rec *r = f->r;
|
request_rec *r = f->r;
|
||||||
bucketeer_ctx_t *ctx = f->ctx;
|
bucketeer_ctx_t *ctx = f->ctx;
|
||||||
bucketeer_filter_config_t *c;
|
bucketeer_filter_config_t *c;
|
||||||
|
apr_status_t rv;
|
||||||
|
|
||||||
c = ap_get_module_config(r->server->module_config, &bucketeer_module);
|
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");
|
apr_table_unset(f->r->headers_out, "Content-Length");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (e = APR_BRIGADE_FIRST(bb);
|
while (!APR_BRIGADE_EMPTY(bb)) {
|
||||||
e != APR_BRIGADE_SENTINEL(bb);
|
|
||||||
e = APR_BUCKET_NEXT(e))
|
|
||||||
{
|
|
||||||
const char *data;
|
const char *data;
|
||||||
apr_size_t len, i, lastpos;
|
apr_size_t len, i, lastpos;
|
||||||
|
|
||||||
|
e = APR_BRIGADE_FIRST(bb);
|
||||||
|
|
||||||
if (APR_BUCKET_IS_EOS(e)) {
|
if (APR_BUCKET_IS_EOS(e)) {
|
||||||
APR_BUCKET_REMOVE(e);
|
APR_BUCKET_REMOVE(e);
|
||||||
APR_BRIGADE_INSERT_TAIL(ctx->bb, 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.
|
* Time to pass it along down the chain.
|
||||||
*/
|
*/
|
||||||
ap_remove_output_filter(f);
|
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)) {
|
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..
|
* Ignore flush buckets for the moment..
|
||||||
* we decide what to stream
|
* we decide what to stream
|
||||||
*/
|
*/
|
||||||
|
apr_bucket_delete(e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (APR_BUCKET_IS_METADATA(e)) {
|
if (APR_BUCKET_IS_METADATA(e)) {
|
||||||
/* metadata bucket */
|
/* metadata bucket */
|
||||||
apr_bucket *cpy;
|
APR_BUCKET_REMOVE(e);
|
||||||
apr_bucket_copy(e, &cpy);
|
apr_bucket_setaside(e, f->r->pool);
|
||||||
APR_BRIGADE_INSERT_TAIL(ctx->bb, cpy);
|
APR_BRIGADE_INSERT_TAIL(ctx->bb, e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,8 +143,6 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
|
|||||||
APR_BRIGADE_INSERT_TAIL(ctx->bb, p);
|
APR_BRIGADE_INSERT_TAIL(ctx->bb, p);
|
||||||
}
|
}
|
||||||
if (data[i] == c->passdelimiter) {
|
if (data[i] == c->passdelimiter) {
|
||||||
apr_status_t rv;
|
|
||||||
|
|
||||||
rv = ap_pass_brigade(f->next, ctx->bb);
|
rv = ap_pass_brigade(f->next, ctx->bb);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
return 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_BRIGADE_INSERT_TAIL(ctx->bb, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apr_bucket_delete(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
|
Reference in New Issue
Block a user