mirror of
https://github.com/apache/httpd.git
synced 2025-08-05 16:55:50 +03:00
util_filter: protect ap_filter_t private fields from external (ab)use.
Introduce opaque struct ap_filter_private to move ap_filter_t "pending", "bb" and "deferred_pool" fields to the "priv" side of things. This allows to trust values set internally (only!) in util_filter code, and make useful assertions between the different functions calls, along with the usual nice extensibility property. Likewise, the private struct ap_filter_conn_ctx in conn_rec (from r1839997) allows now to implement the new ap_acquire_brigade() and ap_release_brigade() functions useful to get a brigade with c->pool's lifetime. They obsolete ap_reuse_brigade_from_pool() which is replaced where previously used. Some comments added in ap_request_core_filter() regarding the lifetime of the data it plays with, up to EOR... MAJOR bumped (once again). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1840149 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -352,11 +352,12 @@ AP_DECLARE(void) ap_process_request_after_handler(request_rec *r)
|
||||
conn_rec *c = r->connection;
|
||||
ap_filter_t *f;
|
||||
|
||||
bb = ap_acquire_brigade(c);
|
||||
|
||||
/* Send an EOR bucket through the output filter chain. When
|
||||
* this bucket is destroyed, the request will be logged and
|
||||
* its pool will be freed
|
||||
*/
|
||||
bb = ap_reuse_brigade_from_pool("ap_prah_bb", c->pool, c->bucket_alloc);
|
||||
b = ap_bucket_eor_create(c->bucket_alloc, r);
|
||||
APR_BRIGADE_INSERT_HEAD(bb, b);
|
||||
|
||||
@@ -399,7 +400,8 @@ AP_DECLARE(void) ap_process_request_after_handler(request_rec *r)
|
||||
* until the next/real request comes in or the keepalive timeout expires.
|
||||
*/
|
||||
(void)ap_check_pipeline(c, bb, DEFAULT_LIMIT_BLANK_LINES);
|
||||
apr_brigade_cleanup(bb);
|
||||
|
||||
ap_release_brigade(c, bb);
|
||||
|
||||
if (!c->aborted) {
|
||||
ap_filter_recycle(c);
|
||||
@@ -507,7 +509,7 @@ AP_DECLARE(void) ap_process_request(request_rec *r)
|
||||
ap_process_async_request(r);
|
||||
|
||||
if (ap_run_input_pending(c) != OK) {
|
||||
bb = ap_reuse_brigade_from_pool("ap_pr_bb", c->pool, c->bucket_alloc);
|
||||
bb = ap_acquire_brigade(c);
|
||||
b = apr_bucket_flush_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_HEAD(bb, b);
|
||||
rv = ap_pass_brigade(c->output_filters, bb);
|
||||
@@ -520,7 +522,7 @@ AP_DECLARE(void) ap_process_request(request_rec *r)
|
||||
ap_log_cerror(APLOG_MARK, APLOG_INFO, rv, c, APLOGNO(01581)
|
||||
"flushing data to the client");
|
||||
}
|
||||
apr_brigade_cleanup(bb);
|
||||
ap_release_brigade(c, bb);
|
||||
}
|
||||
if (ap_extended_status) {
|
||||
ap_time_process_request(c->sbh, STOP_PREQUEST);
|
||||
|
Reference in New Issue
Block a user