* new bucket brigade is returned in this location.
* @param b The bucket brigade to save aside. This brigade is always empty
* on return
+ * @param p Ensure that all data in the brigade lives as long as this pool
*/
AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, apr_bucket_brigade **save_to,
- apr_bucket_brigade **b);
+ apr_bucket_brigade **b, apr_pool_t *p);
/**
* Flush function for apr_brigade_* calls. This calls ap_pass_brigade
}
/* Set aside tag, pass pre-tag... */
tag_and_after = apr_brigade_split(*bb, ctx->head_start_bucket);
- ap_save_brigade(f, &ctx->ssi_tag_brigade, &tag_and_after);
+ ap_save_brigade(f, &ctx->ssi_tag_brigade, &tag_and_after, r->pool);
ap_pass_brigade(f->next, *bb);
ctx->bytes_parsed = 0;
}
* we SHOULD return the data in the same order it was requested.
*/
if (!APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
- ap_save_brigade(f, &ctx->bb, &bb);
+ ap_save_brigade(f, &ctx->bb, &bb, r->pool);
return APR_SUCCESS;
}
return HTTP_METHOD_NOT_ALLOWED;
}
main_pool = (r->main) ? (r->main->pool) : (r->pool);
-
+
if ((status = apr_file_open(&fd, r->filename, APR_READ | APR_BINARY, 0, main_pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
"file permissions deny server access: %s", r->filename);
apr_brigade_destroy(b);
}
else {
- ap_save_brigade(f, &ctx->b, &b);
+ ap_save_brigade(f, &ctx->b, &b, c->pool);
}
return APR_SUCCESS;
}
}
if ((ctx->curr_len < AP_MIN_BYTES_TO_WRITE) && !send_it) {
- return ap_save_brigade(f, &ctx->saved, &b);
+ return ap_save_brigade(f, &ctx->saved, &b, r->pool);
}
/* We will compute a content length if:
* filter until we have the entire content length
*/
if (!send_it) {
- ap_save_brigade(f, &ctx->saved, &b);
+ ap_save_brigade(f, &ctx->saved, &b, r->pool);
return APR_SUCCESS;
}
ap_set_content_length(r, r->bytes_sent);
}
AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, apr_bucket_brigade **saveto,
- apr_bucket_brigade **b)
+ apr_bucket_brigade **b, apr_pool_t *p)
{
apr_bucket *e;
- /* ### this pool should be passed in; the caller is the only one who
- ### really knows what the proper lifetime is for this pool. */
- apr_pool_t *p = f->r ? f->r->pool : f->c->pool;
apr_status_t rv;
/* If have never stored any data in the filter, then we had better