]> granicus.if.org Git - apache/commitdiff
Resolve the ap_get_client_block() showstopper by looking at APR_BRIGADE_LAST
authorJustin Erenkrantz <jerenkrantz@apache.org>
Sun, 31 Aug 2003 16:14:39 +0000 (16:14 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Sun, 31 Aug 2003 16:14:39 +0000 (16:14 +0000)
of what we get from ap_get_brigade and set a nugget for our next call to
pick up on.

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

CHANGES
STATUS
modules/http/http_protocol.c

diff --git a/CHANGES b/CHANGES
index 75fb5ea71919fa54de34b0b219069ca087eb4fd8..40e9ff37589d927345d35485f2fc483c5363044b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Modify ap_get_client_block() to note if it has seen EOS.
+     [Justin Erenkrantz]
+
   *) The bucket brigades subsystem now honors the MaxMemFree setting.
      [Cliff Woolley, Jean-Jacques Clar]
 
diff --git a/STATUS b/STATUS
index abb555d428ce04b08c7ed81e2f1dbdecd8750c55..2856232b482cb3bc8bdec7bca1cd718cae68d5a5 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.1 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2003/08/06 04:02:34 $]
+Last modified at [$Date: 2003/08/31 16:14:38 $]
 
 Release [NOTE that only Alpha/Beta releases occur in 2.1 development]:
 
@@ -28,9 +28,6 @@ RELEASE SHOWSTOPPERS:
     * the edge connection filter cannot be removed 
       http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=105366252619530&w=2
 
-    * bug in ap_get_client_block (wrong handling of EOS)
-      http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=105281649228629&w=2
-
 CURRENT VOTES:
 
     * Promote mod_cache from experimental to non-experimental
index 61cb7f6eea2d2e06e68f81988f33c2e50de67d03..6749f828156e5af6124504f1ec26937ebb861af1 100644 (file)
@@ -1910,6 +1910,10 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer,
     apr_status_t rv;
     apr_bucket_brigade *bb;
 
+    if (r->remaining < 0 || (!r->read_chunked && r->remaining == 0)) {
+        return 0;
+    }
+
     bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
     if (bb == NULL) {
         r->connection->keepalive = AP_CONN_CLOSE;
@@ -1936,7 +1940,21 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer,
      * returning data when requested.
      */
     AP_DEBUG_ASSERT(!APR_BRIGADE_EMPTY(bb));
+
+    /* Check to see if EOS in the brigade.
+     *
+     * If so, we have to leave a nugget for the *next* ap_get_client_block
+     * call to return 0.
+     */
+    if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
+        if (r->read_chunked) {
+            r->remaining = -1;
+        }
+        else {
+            r->remaining = 0;
+        }
+    }
+
     rv = apr_brigade_flatten(bb, buffer, &bufsiz);
     if (rv != APR_SUCCESS) {
         apr_brigade_destroy(bb);