]> granicus.if.org Git - apache/commitdiff
make it work with flushes
authorIan Holsman <ianh@apache.org>
Sat, 23 Feb 2002 20:56:36 +0000 (20:56 +0000)
committerIan Holsman <ianh@apache.org>
Sat, 23 Feb 2002 20:56:36 +0000 (20:56 +0000)
make the false alarm not as generic
PR:
Obtained from:
Submitted by:
Reviewed by:  Ian, Brian, Justin

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

CHANGES
modules/filters/mod_include.c
modules/filters/mod_include.h

diff --git a/CHANGES b/CHANGES
index 05f4215bbd4a6ef2ba5429d148f334ed1faf1219..5c52a5f8ec7c235d40f092048fe1339bac52a1b2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,6 @@
 Changes with Apache 2.0.33-dev
+  *) mod-include: make it handle flush'es and fix the 'false-alarm'
+     [Justin Everkrantz, Brian Pane, Ian Holsman]
 
   *) ap_get_*_filter_handle() functions to allow 3rd party modules
      to lookup filter handles so they can bypass the filter name
index 2f1cd5eff5ac160384eaa202166e8bff20d4f74f..c6880ba9cd8b6d34a856635ecef2f2be4644e9f1 100644 (file)
@@ -366,7 +366,14 @@ static apr_bucket *find_start_sequence(apr_bucket *dptr, include_ctx_t *ctx,
             break;
         }
 
-        if (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD) {
+        if (APR_BUCKET_IS_FLUSH(dptr)) {
+            apr_bucket *old = dptr; 
+            dptr = APR_BUCKET_NEXT(old);
+            APR_BUCKET_REMOVE(old);
+            ctx->output_now = 1;
+            ctx->output_flush = 1;
+        }
+        else if (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD) {
             ctx->output_now = 1;
         }
         else if (ctx->bytes_parsed > 0) {
@@ -430,9 +437,11 @@ static apr_bucket *find_start_sequence(apr_bucket *dptr, include_ctx_t *ctx,
             }
 
             /* False alarm... 
-             * send out the unmatched part
              */
-            if (ctx->parse_pos > 0) {
+            /* send out the unmatched part
+             */
+             
+            if ((ctx->parse_pos > 0) && (ctx->bytes_parsed == 0)) {
                 apr_bucket *tmp_buck;
                 tmp_buck = apr_bucket_pool_create(apr_pstrndup(ctx->pool,
                                                                ctx->start_seq,
@@ -441,6 +450,8 @@ static apr_bucket *find_start_sequence(apr_bucket *dptr, include_ctx_t *ctx,
                                                   ctx->pool);
                 APR_BUCKET_INSERT_BEFORE(dptr, tmp_buck);
             }
+
+
             ctx->state = PRE_HEAD;
         }
 
@@ -501,6 +512,8 @@ static apr_bucket *find_start_sequence(apr_bucket *dptr, include_ctx_t *ctx,
         }
         dptr = APR_BUCKET_NEXT(dptr);
     } while (dptr != APR_BRIGADE_SENTINEL(bb));
+          
+  
     return NULL;
 }
 
@@ -519,7 +532,14 @@ static apr_bucket *find_end_sequence(apr_bucket *dptr, include_ctx_t *ctx,
         if (APR_BUCKET_IS_EOS(dptr)) {
             break;
         }
-        if (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD) {
+        if (APR_BUCKET_IS_FLUSH(dptr)) {
+            apr_bucket *old = dptr; 
+            dptr = APR_BUCKET_NEXT(old);
+            APR_BUCKET_REMOVE(old);
+            ctx->output_now = 1;
+            ctx->output_flush = 1;
+        }
+        else if (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD) {
             ctx->output_now = 1;
         }
         else if (ctx->bytes_parsed > 0) {
@@ -2888,12 +2908,17 @@ static apr_status_t send_parsed_content(apr_bucket_brigade **bb,
                       (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD))) {
                 /* Send the large chunk of pre-tag bytes...  */
                 tag_and_after = apr_brigade_split(*bb, tmp_dptr);
+                if (ctx->output_flush) {
+                    APR_BRIGADE_INSERT_TAIL(*bb, apr_bucket_flush_create());
+                }
+
                 rv = ap_pass_brigade(f->next, *bb);
                 if (rv != APR_SUCCESS) {
                     return rv;
                 }
                 *bb  = tag_and_after;
                 dptr = tmp_dptr;
+                ctx->output_flush = 0;
                 ctx->bytes_parsed = 0;
                 ctx->output_now = 0;
             }
@@ -2936,6 +2961,7 @@ static apr_status_t send_parsed_content(apr_bucket_brigade **bb,
                     if (rv != APR_SUCCESS) {
                         return rv;
                     }
+                    ctx->output_flush = 0;
                     ctx->output_now = 0;
                 }
             }
index 1f143884b39993c30dcbe0b1b1522698b45900c4..d7996fa5d8275eb4db81a4dfe5f38f2453260c27 100644 (file)
@@ -143,6 +143,7 @@ typedef struct include_filter_ctx {
     int          bytes_parsed;
     apr_status_t status;
     int          output_now;
+    int          output_flush;
     
     apr_bucket   *head_start_bucket;
     apr_size_t   head_start_index;
@@ -206,6 +207,9 @@ if ((APR_BRIGADE_EMPTY(cntxt->ssi_tag_brigade)) &&                \
     apr_bucket_brigade *tag_plus;                                 \
                                                                   \
     tag_plus = apr_brigade_split(brgd, cntxt->head_start_bucket); \
+    if (cntxt->output_flush) {                                    \
+        APR_BRIGADE_INSERT_TAIL(brgd, apr_bucket_flush_create()); \
+    }                                                             \
     rc = ap_pass_brigade(next, brgd);                             \
     cntxt->bytes_parsed = 0;                                      \
     brgd = tag_plus;                                              \