From 86a1ecbda005bc79324c48095a3a1e4db332c8d0 Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Tue, 17 Oct 2000 00:24:36 +0000 Subject: [PATCH] Add a flush bucket type. This bucket advises filters to flush any data 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 | 6 ++---- modules/http/http_core.c | 4 ++-- modules/http/http_protocol.c | 19 ++++++++++--------- modules/http/http_request.c | 6 ------ 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/STATUS b/STATUS index 3864e0b625..3b6ee55d55 100644 --- 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 diff --git a/modules/http/http_core.c b/modules/http/http_core.c index c3b789bb0d..c5d32e4f05 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -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; } diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index f93febd960..186b018d93 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -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("\n", r); } ap_finalize_request_protocol(r); - ap_rflush(r); } AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request, diff --git a/modules/http/http_request.c b/modules/http/http_request.c index cc97c33d38..72422808c5 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -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); }