]> granicus.if.org Git - apache/commitdiff
yet another tweak to empty brigade checking on entry to core_input_filter():
authorJeff Trawick <trawick@apache.org>
Wed, 6 Feb 2002 16:16:55 +0000 (16:16 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 6 Feb 2002 16:16:55 +0000 (16:16 +0000)
  since APR_BRIGADE_EMPTY() assumes a non-empty brigade, we have to check
  before invoking that macro

  since APR_BRIGADE_EMPTY() can make a brigade empty, we have to check
  after invoking that macro

An obvious variation of this fix would be to change APR_BRIGADE_NORMALIZE()
to deal with empty brigades.

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

server/core.c

index 8dc7ff2308aeafb2c8485f46c24dc14d4e147747..c55e114ac446b85aef5f0d49b193f41793714058 100644 (file)
@@ -3058,11 +3058,14 @@ static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
         APR_BRIGADE_INSERT_TAIL(ctx->b, e);
         net->in_ctx = ctx;
     }
-
+    else if (APR_BRIGADE_EMPTY(ctx->b)) {
+        return APR_EOF;
+    }
+    
     /* ### This is bad. */
     APR_BRIGADE_NORMALIZE(ctx->b);
 
-    /* check for empty brigade *AFTER* APR_BRIGADE_NORMALIZE()
+    /* check for empty brigade again *AFTER* APR_BRIGADE_NORMALIZE()
      * If we have lost our socket bucket (see above), we are EOF.
      *
      * Ideally, this should be returning SUCCESS with EOS bucket, but