1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

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
This commit is contained in:
Ryan Bloom
2000-10-17 00:24:36 +00:00
parent 25535f86ec
commit 86a1ecbda0
4 changed files with 14 additions and 21 deletions

6
STATUS
View File

@@ -1,5 +1,5 @@
Apache 2.0 STATUS: 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: Release:
@@ -19,9 +19,7 @@ RELEASE SHOWSTOPPERS:
WIN32 and OS2 need review [William Rowe, Brian Harvard] WIN32 and OS2 need review [William Rowe, Brian Harvard]
* All of the bucket types must be implemented. The list can be found * 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 in src/include/ap_buckets.h.
to tell filters to flush any pending content. See http_protocol.c:
ap_rflush()
* Remove Buff from the code. Some buff functionality is currently * Remove Buff from the code. Some buff functionality is currently
missing: input translation filter, translation of protocol data for missing: input translation filter, translation of protocol data for

View File

@@ -3117,7 +3117,7 @@ static apr_status_t buffer_filter(ap_filter_t *f, ap_bucket_brigade *b)
destroy_me = NULL; destroy_me = NULL;
} }
if (AP_BUCKET_IS_EOS(e) || AP_BUCKET_IS_FILE(e) || 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; pass_the_brigade = 1;
} }
else { 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 /* Completed iterating over the brigades, now determine if we want to
* buffer the brigade or send the brigade out on the network * 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); ap_save_brigade(f, &ctx->b, &b);
return APR_SUCCESS; return APR_SUCCESS;
} }

View File

@@ -2810,18 +2810,22 @@ AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r, ...)
AP_DECLARE(int) ap_rflush(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; apr_status_t rv;
if ((rv = ap_bflush(r->connection->client)) != APR_SUCCESS) { if ((rv = ap_bflush(r->connection->client)) != APR_SUCCESS) {
check_first_conn_error(r, "rflush", rv); check_first_conn_error(r, "rflush", rv);
return EOF; 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; return 0;
} }
@@ -3155,7 +3159,6 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
if (r->header_only) { if (r->header_only) {
ap_finalize_request_protocol(r); ap_finalize_request_protocol(r);
ap_rflush(r);
return; return;
} }
} }
@@ -3176,7 +3179,6 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
if (custom_response[0] == '\"') { if (custom_response[0] == '\"') {
ap_rputs(custom_response + 1, r); ap_rputs(custom_response + 1, r);
ap_finalize_request_protocol(r); ap_finalize_request_protocol(r);
ap_rflush(r);
return; 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_rputs("</BODY></HTML>\n", r);
} }
ap_finalize_request_protocol(r); ap_finalize_request_protocol(r);
ap_rflush(r);
} }
AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request, AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request,

View File

@@ -1355,12 +1355,6 @@ static void process_request_internal(request_rec *r)
return; 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 */ /* Take care of little things that need to happen when we're done */
ap_finalize_request_protocol(r); ap_finalize_request_protocol(r);
} }