core: Add ap_reuse_brigade_from_pool().

Current RETRIEVE_BRIGADE_FROM_POOL macro from "http_request.c" is turned into
a helper and used in ap_request_core_filter().

We will need it in a subsequent commit in "util_filter.c" too.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1836018 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yann Ylavic
2018-07-16 11:06:57 +00:00
parent fdea2be62f
commit eb5e821bea
5 changed files with 37 additions and 26 deletions

View File

@ -2081,13 +2081,8 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_request_core_filter(ap_filter_t *f,
}
if (!tmp_bb) {
const char *tmp_bb_key = "ap_request_core_filter_bb";
tmp_bb = (void *)apr_table_get(f->c->notes, tmp_bb_key);
if (!tmp_bb) {
tmp_bb = apr_brigade_create(f->c->pool, f->c->bucket_alloc);
apr_table_setn(f->c->notes, tmp_bb_key, (void *)tmp_bb);
}
f->ctx = tmp_bb;
f->ctx = tmp_bb = ap_reuse_brigade_from_pool("ap_rcf_bb", f->c->pool,
f->c->bucket_alloc);
}
/* Reinstate any buffered content */
@ -2137,13 +2132,12 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_request_core_filter(ap_filter_t *f,
}
status = ap_pass_brigade(f->next, tmp_bb);
apr_brigade_cleanup(tmp_bb);
if (seen_eor || (status != APR_SUCCESS &&
!APR_STATUS_IS_EOF(status))) {
apr_brigade_cleanup(tmp_bb);
return status;
}
apr_brigade_cleanup(tmp_bb);
}
return ap_filter_setaside_brigade(f, bb);