]> granicus.if.org Git - apache/commitdiff
Fix problem handling FLUSH bucket in the chunked encoding filter.
authorBill Stoddard <stoddard@apache.org>
Tue, 26 Jun 2001 17:40:58 +0000 (17:40 +0000)
committerBill Stoddard <stoddard@apache.org>
Tue, 26 Jun 2001 17:40:58 +0000 (17:40 +0000)
Module was calling ap_rwrite() followed by ap_rflush() but the
served content was not being displayed in the browser. Inspection
of the output stream revealed that the first data chunk was
missing the trailing CRLF required by the RFC

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

CHANGES
modules/http/http_core.c

diff --git a/CHANGES b/CHANGES
index 4dd1824208dbd774eef1f28d75c889386da9bf7c..8b3ae483b9ffad724788bb9653ca1c4f0073ac36 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,11 @@
 Changes with Apache 2.0.19-dev
 
+  *) Fix problem handling FLUSH bucket in the chunked encoding filter.
+     Module was calling ap_rwrite() followed by ap_rflush() but the 
+     served content was not being displayed in the browser. Inspection
+     of the output stream revealed that the first data chunk was
+     missing the trailing CRLF required by the RFC.
+
   *) apxs no longer generates ap_send_http_header() in the example handler
 
   *) Fix an ab problem which could cause a divide-by-zero exception
index 06a2c2de5518979fe4821ac6c965d6f5b2b8321e..302d3239380ed132cb3b75c8bce6f0ac8ed17cb7 100644 (file)
@@ -144,6 +144,7 @@ static apr_status_t chunk_filter(ap_filter_t *f, apr_bucket_brigade *b)
     for (more = NULL; b; b = more, more = NULL) {
        apr_off_t bytes = 0;
         apr_bucket *eos = NULL;
+        apr_bucket *flush = NULL;
         char chunk_hdr[20]; /* enough space for the snprintf below */
 
        APR_BRIGADE_FOREACH(e, b) {
@@ -152,6 +153,9 @@ static apr_status_t chunk_filter(ap_filter_t *f, apr_bucket_brigade *b)
                eos = e;
                break;
            }
+            if (APR_BUCKET_IS_FLUSH(e)) {
+                flush = e;
+            }
            else if (e->length == -1) {
                 /* unknown amount of data (e.g. a pipe) */
                const char *data;
@@ -206,13 +210,16 @@ static apr_status_t chunk_filter(ap_filter_t *f, apr_bucket_brigade *b)
             APR_BRIGADE_INSERT_HEAD(b, e);
 
             /*
-             * Insert the end-of-chunk CRLF before the EOS bucket, or
-             * appended to the brigade
+             * Insert the end-of-chunk CRLF before an EOS or
+             * FLUSH bucket, or appended to the brigade
              */
             e = apr_bucket_immortal_create(ASCII_CRLF, 2);
             if (eos != NULL) {
                 APR_BUCKET_INSERT_BEFORE(eos, e);
             }
+            else if (flush != NULL) {
+                APR_BUCKET_INSERT_BEFORE(flush, e);
+            }
             else {
                 APR_BRIGADE_INSERT_TAIL(b, e);
             }