From 46c701dc7f7ab2dde32b930b60ce26434377a209 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Wed, 1 Nov 2000 18:42:55 +0000 Subject: [PATCH] Create the pool bucket after we know the true length, because (currently) we can't shorten the length of such a bucket by setting e->length. (We could split and then remove the extra bucket, but this seems cleaner. We may still want to have a way to shorten a bucket, but there isn't a pressing need for that at the moment.) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86790 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_protocol.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 76667af476..d592d6d8b4 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2322,7 +2322,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, ap_bu const long int zero = 0L; char *date = NULL; request_rec *r = f->r; - char *buff; + char *buff, *buff_start; ap_bucket *e; ap_bucket_brigade *b2; apr_size_t len = 0; @@ -2414,8 +2414,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, ap_bu * and the basic http headers don't overflow this buffer. */ len += strlen(ap_get_server_version()) + 100; - buff = apr_pcalloc(r->pool, len); - e = ap_bucket_create_pool(buff, len, r->pool); + buff_start = buff = apr_pcalloc(r->pool, len); ap_basic_http_header(r, buff); buff += strlen(buff); @@ -2434,8 +2433,8 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, ap_bu if (r->chunked) { ap_bsetflag(r->connection->client, B_CHUNK, 1); } - e->length = strlen(buff) + 1; b2 = ap_brigade_create(r->pool); + e = ap_bucket_create_pool(buff_start, strlen(buff_start), r->pool); AP_BRIGADE_INSERT_HEAD(b2, e); ap_remove_output_filter(f); ap_pass_brigade(f->next, b2); -- 2.40.0