From: Stefan Fritsch Date: Mon, 15 Feb 2010 20:12:07 +0000 (+0000) Subject: Correctly handle the case where apr_brigade_partition() returns APR_INCOMPLETE X-Git-Tag: 2.3.6~471 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6d11299afca0b5cefe7591a46877a3c1f6e84d6;p=apache Correctly handle the case where apr_brigade_partition() returns APR_INCOMPLETE and bkt points to the sentinel of ctx->proc_bb and not the sentinel of bb. Submitted by: Joe Schaefer git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@910326 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 2322ef8e59..30c620d338 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -1019,11 +1019,13 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, } if (!APR_BRIGADE_EMPTY(ctx->proc_bb)) { - /* May return APR_INCOMPLETE which is fine by us. */ - apr_brigade_partition(ctx->proc_bb, readbytes, &bkt); - - APR_BRIGADE_CONCAT(bb, ctx->proc_bb); - apr_brigade_split_ex(bb, bkt, ctx->proc_bb); + if (apr_brigade_partition(ctx->proc_bb, readbytes, &bkt) == APR_INCOMPLETE) { + APR_BRIGADE_CONCAT(bb, ctx->proc_bb); + } + else { + APR_BRIGADE_CONCAT(bb, ctx->proc_bb); + apr_brigade_split_ex(bb, bkt, ctx->proc_bb); + } } return APR_SUCCESS;