From: Sascha Schumann Date: Fri, 27 Oct 2000 13:30:41 +0000 (+0000) Subject: Looks like transient buckets are limited to 4096 bytes, so split up writes. X-Git-Tag: php-4.0.4RC3~494 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b52239729886d57369a550892218eff1c778456b;p=php Looks like transient buckets are limited to 4096 bytes, so split up writes. --- diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 7158dbec6e..3d36842f11 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -29,13 +29,19 @@ php_apache_sapi_ub_write(const char *str, uint str_length) ap_bucket *b; ap_bucket_brigade *bb; php_struct *ctx; + uint now; SLS_FETCH(); ctx = SG(server_context); bb = ap_brigade_create(ctx->f->r->pool); - b = ap_bucket_create_transient(str, str_length); - AP_BRIGADE_INSERT_TAIL(bb, b); + while (str_length > 0) { + now = MIN(str_length, 4096); + b = ap_bucket_create_transient(str, now); + AP_BRIGADE_INSERT_TAIL(bb, b); + str += now; + str_length -= now; + } ap_pass_brigade(ctx->f->next, bb); return str_length; @@ -313,7 +319,8 @@ ok: eos = ap_bucket_create_eos(); AP_BRIGADE_INSERT_TAIL(bb, eos); ap_pass_brigade(f->next, bb); - } + } else + ap_brigade_destroy(bb); return APR_SUCCESS; }