From 66a61c359d5b20224bac2b8224a83a6abf28059a Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Wed, 13 Jun 2001 13:44:40 +0000 Subject: [PATCH] Add a pool to the ap_save_brigade prototype. This removes a todo from the comments that is really necessary before the setaside stuff will work properly. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89362 13f79535-47bb-0310-9956-ffa450edef68 --- include/util_filter.h | 3 ++- modules/filters/mod_include.c | 2 +- modules/http/http_protocol.c | 2 +- server/core.c | 4 ++-- server/protocol.c | 4 ++-- server/util_filter.c | 5 +---- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/util_filter.h b/include/util_filter.h index 430e9ee945..e595686e1f 100644 --- a/include/util_filter.h +++ b/include/util_filter.h @@ -378,9 +378,10 @@ AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f); * 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 diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 589ff6bf5b..503c73b695 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -2620,7 +2620,7 @@ static void send_parsed_content(apr_bucket_brigade **bb, request_rec *r, } /* 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; } diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 0d2b9ed65e..b5e6b4b107 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2282,7 +2282,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( * 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; } diff --git a/server/core.c b/server/core.c index ec32496feb..c1bc54dc44 100644 --- a/server/core.c +++ b/server/core.c @@ -2966,7 +2966,7 @@ static int default_handler(request_rec *r) 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); @@ -3173,7 +3173,7 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) apr_brigade_destroy(b); } else { - ap_save_brigade(f, &ctx->b, &b); + ap_save_brigade(f, &ctx->b, &b, c->pool); } return APR_SUCCESS; } diff --git a/server/protocol.c b/server/protocol.c index 5bf304969d..d0b9b2a094 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -881,7 +881,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f, } 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: @@ -911,7 +911,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f, * 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); diff --git a/server/util_filter.c b/server/util_filter.c index 8e8f770736..86833583aa 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -245,12 +245,9 @@ AP_DECLARE(apr_status_t) ap_pass_brigade(ap_filter_t *next, apr_bucket_brigade * } 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 -- 2.40.0