]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
merge this fix from 2.1-dev:
authorJeff Trawick <trawick@apache.org>
Wed, 17 Sep 2003 10:47:39 +0000 (10:47 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 17 Sep 2003 10:47:39 +0000 (10:47 +0000)
    * Fix EOS handling in ap_get_client_block.

Submitted by: jerenkrantz
Reviewed by: trawick, fielding

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

CHANGES
STATUS
modules/http/http_protocol.c

diff --git a/CHANGES b/CHANGES
index b5a7e06fdca3101904128beb6c0abb150162e20f..11ebf5f01ac01574380473b48c17b4a37ad23eb4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.48
 
+  *) Modify ap_get_client_block() to note if it has seen EOS.
+     [Justin Erenkrantz]
+
   *) Fix a bug, where mod_deflate sometimes unconditionally compressed the
      content if the Accept-Encoding header contained only other tokens than
      "gzip" (such as "deflate"). PR 21523.  [Joe Orton, AndrĂ© Malo]
diff --git a/STATUS b/STATUS
index b840e33b03610f3498e3b38721f2b95e4ee7ad21..0b6f52173b219efd4b66fea9d49252e5708235d3 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2003/09/17 10:39:43 $]
+Last modified at [$Date: 2003/09/17 10:47:38 $]
 
 Release:
 
@@ -333,11 +333,6 @@ PATCHES TO PORT FROM 2.1
         modules/ssl/ssl_engine_io.c r1.111
       +1: jorton
 
-    * Fix EOS handling in ap_get_client_block.
-        modules/http/http_protocol.c: r1.471
-      See Message-ID: <3EC0B430.4010008@stason.org>
-      +1: jerenkrantz, trawick, fielding
-
 CURRENT RELEASE NOTES:
 
     * Backwards compatibility is expected of future Apache 2.0 releases,
index 8d120bb767b06f910a1defe4b56bbf3e6511ed0d..e80c531eaf40b00becd447b82f14fdb27c8af1ba 100644 (file)
@@ -1890,6 +1890,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;
@@ -1916,7 +1920,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);