]> granicus.if.org Git - apache/commitdiff
Create the pool bucket after we know the true length, because
authorJeff Trawick <trawick@apache.org>
Wed, 1 Nov 2000 18:42:55 +0000 (18:42 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 1 Nov 2000 18:42:55 +0000 (18:42 +0000)
(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

index 76667af47624bbef7ada508a3884b0ec779377c8..d592d6d8b4a7877a6ca5dcf2c487e3bdb95463b0 100644 (file)
@@ -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);