]> granicus.if.org Git - apache/commitdiff
Add a flush bucket type. This bucket advises filters to flush any data
authorRyan Bloom <rbb@apache.org>
Tue, 17 Oct 2000 00:24:36 +0000 (00:24 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 17 Oct 2000 00:24:36 +0000 (00:24 +0000)
they are currently storing.  There is no way we can force them to flush,
but we can advise.  This also adds the code to ap_rflush to use flush
buckets, although it isn't enabled yet.  I will enable it once we remove
buff from the code.  I also removed all calls to ap_rflush that are either
immediately before or immediately after a call to ap_finalize_protocol.
ap_finalize_protocol sends an EOS bucket, which also advises filters to
flush their data, so having both calls right next to each other is
redundant.

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

STATUS
modules/http/http_core.c
modules/http/http_protocol.c
modules/http/http_request.c

diff --git a/STATUS b/STATUS
index 3864e0b625fdae2dcc00840a51cebdb227cdc06b..3b6ee55d559ecfcef83d1cfdcf29e3690bd80e61 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 Apache 2.0 STATUS:
-Last modified at [$Date: 2000/10/16 23:15:54 $]
+Last modified at [$Date: 2000/10/17 00:24:28 $]
 
 Release:
 
@@ -19,9 +19,7 @@ RELEASE SHOWSTOPPERS:
                 WIN32 and OS2 need review [William Rowe, Brian Harvard]
 
     * All of the bucket types must be implemented.  The list can be found
-      in src/include/ap_buckets.h. May need to implement a bucket type
-      to tell filters to flush any pending content. See http_protocol.c:
-      ap_rflush()
+      in src/include/ap_buckets.h.
 
     * Remove Buff from the code.  Some buff functionality is currently 
       missing: input translation filter, translation of protocol data for 
index c3b789bb0dfbc3e41bb86695f74edc75ee25fbd9..c5d32e4f05f41ca85915599348df398a9e47417e 100644 (file)
@@ -3117,7 +3117,7 @@ static apr_status_t buffer_filter(ap_filter_t *f, ap_bucket_brigade *b)
             destroy_me = NULL;
         }
         if (AP_BUCKET_IS_EOS(e)  || AP_BUCKET_IS_FILE(e) ||
-            AP_BUCKET_IS_PIPE(e)) {
+            AP_BUCKET_IS_PIPE(e) || AP_BUCKET_IS_FLUSH(e)) {
             pass_the_brigade = 1;
         }
         else {
@@ -3441,7 +3441,7 @@ static int core_output_filter(ap_filter_t *f, ap_bucket_brigade *b)
         /* Completed iterating over the brigades, now determine if we want to
          * buffer the brigade or send the brigade out on the network
          */
-        if (!fd && (!more) && (nbytes < MIN_SIZE_TO_WRITE) && !AP_BUCKET_IS_EOS(e)) {
+        if (!fd && (!more) && (nbytes < MIN_SIZE_TO_WRITE) && !AP_BUCKET_IS_EOS(e) && !AP_BUCKET_IS_FLUSH(e)) {
             ap_save_brigade(f, &ctx->b, &b);
             return APR_SUCCESS;
         }
index f93febd960eb4fa645465ce7d1e78b88dbbede3c..186b018d93092a54a3d5e7dfcdab930987beba84 100644 (file)
@@ -2810,18 +2810,22 @@ AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r, ...)
 
 AP_DECLARE(int) ap_rflush(request_rec *r)
 {
-    /* ### this is probably incorrect, but we have no mechanism for telling
-       ### the filter chain to flush any content they may be holding.
-
-       ### add a FLUSH bucket type?
-    */
-
     apr_status_t rv;
 
     if ((rv = ap_bflush(r->connection->client)) != APR_SUCCESS) {
         check_first_conn_error(r, "rflush", rv);
         return EOF;
     }
+#if USE_FLUSH_BUCKET
+    /* we should be using a flush bucket to flush the stack, not buff code. */
+    ap_bucket_brigade *bb;
+    ap_bucket *b;
+
+    bb = ap_brigade_create(r->pool);
+    b = ap_bucket_create_flush();
+    AP_BRIGADE_INSERT_TAIL(bb, b);
+    ap_pass_brigade(r->output_filters, bb);
+#endif
     return 0;
 }
 
@@ -3155,7 +3159,6 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
 
         if (r->header_only) {
             ap_finalize_request_protocol(r);
-            ap_rflush(r);
             return;
         }
     }
@@ -3176,7 +3179,6 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
         if (custom_response[0] == '\"') {
             ap_rputs(custom_response + 1, r);
             ap_finalize_request_protocol(r);
-            ap_rflush(r);
             return;
         }
         /*
@@ -3223,7 +3225,6 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
         ap_rputs("</BODY></HTML>\n", r);
     }
     ap_finalize_request_protocol(r);
-    ap_rflush(r);
 }
 
 AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request,
index cc97c33d38c0800d0c5cc719a92545cf9f016100..72422808c5a32f8bb58159cd668de2e7a458cfba 100644 (file)
@@ -1355,12 +1355,6 @@ static void process_request_internal(request_rec *r)
         return;
     }
 
-    /* We need to flush the data out at this point.  We probably only want to
-     * do this on the main request, but this is fine for an initial patch.
-     * Once we look into this more, we won't flush sub-requests.
-     */
-    ap_rflush(r);
-
     /* Take care of little things that need to happen when we're done */
     ap_finalize_request_protocol(r);
 }