]> granicus.if.org Git - apache/commitdiff
Correctly handle the case where apr_brigade_partition() returns APR_INCOMPLETE
authorStefan Fritsch <sf@apache.org>
Mon, 15 Feb 2010 20:12:07 +0000 (20:12 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 15 Feb 2010 20:12:07 +0000 (20:12 +0000)
and bkt points to the sentinel of ctx->proc_bb and not the sentinel of bb.

Submitted by: Joe Schaefer <joe_schaefer yahoo com>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@910326 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_deflate.c

index 2322ef8e59711bbc205e824966e9753240f4150b..30c620d3380dbcc3a976205c4dc62e15491727eb 100644 (file)
@@ -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;