On 07/19/2018 12:36 AM, [email protected] wrote:
> Author: ylavic
> Date: Wed Jul 18 22:36:19 2018
> New Revision: 1836239
>
> URL: http://svn.apache.org/viewvc?rev=1836239&view=rev
> Log:
> core: integrate data_in_{in,out}put_filter to ap_filter_{in,out}put_pending().
>
> Straightforward for ap_filter_input_pending() since c->data_in_input_filter is
> always checked wherever ap_run_input_pending(c) is.
>
> For ap_filter_input_pending(), it allows to set c->data_in_output_filter in
> ap_process_request_after_handler() to avoid an useless flush from mpm_event.
>
> Modified:
> httpd/httpd/trunk/include/httpd.h
> httpd/httpd/trunk/modules/http/http_request.c
> httpd/httpd/trunk/server/mpm/event/event.c
> httpd/httpd/trunk/server/mpm/motorz/motorz.c
> httpd/httpd/trunk/server/mpm/simple/simple_io.c
> httpd/httpd/trunk/server/util_filter.c
>
> Modified: httpd/httpd/trunk/modules/http/http_request.c
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_request.c?rev=1836239&r1=1836238&r2=1836239&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/http/http_request.c (original)
> +++ httpd/httpd/trunk/modules/http/http_request.c Wed Jul 18 22:36:19 2018
> @@ -403,9 +403,20 @@ AP_DECLARE(void) ap_process_request_afte
> c->data_in_input_filters = (rv == APR_SUCCESS);
> apr_brigade_cleanup(bb);
>
> - if (c->cs)
> - c->cs->state = (c->aborted) ? CONN_STATE_LINGER
> - : CONN_STATE_WRITE_COMPLETION;
> + if (c->cs) {
> + if (c->aborted) {
> + c->cs->state = CONN_STATE_LINGER;
> + }
> + else {
> + /* If we have still data in the output filters here it means that
> + * the last (recent) nonblocking write was EAGAIN, so tell the
> MPM
> + * to not try another useless/stressful one but to go straight to
> + * POLLOUT.
> + */
> + c->data_in_output_filters =
> ap_filter_should_yield(c->output_filters);
> + c->cs->state = CONN_STATE_WRITE_COMPLETION;
> + }
> + }
> AP_PROCESS_REQUEST_RETURN((uintptr_t)r, r->uri, r->status);
> if (ap_extended_status) {
> ap_time_process_request(c->sbh, STOP_PREQUEST);
> @@ -494,7 +505,7 @@ AP_DECLARE(void) ap_process_request(requ
>
> ap_process_async_request(r);
>
> - if (!c->data_in_input_filters || ap_run_input_pending(c) != OK) {
> + if (ap_run_input_pending(c) != OK) {
We have a different code flow here now. If c->data_in_input_filters is 0, then
ap_filter_input_pending does iterate over the ring whereas it did not do before,
because it was not called.
> bb = ap_reuse_brigade_from_pool("ap_pr_bb", c->pool,
> c->bucket_alloc);
> b = apr_bucket_flush_create(c->bucket_alloc);
> APR_BRIGADE_INSERT_HEAD(bb, b);
>
Regards
RĂ¼diger