From: Yann Ylavic Date: Tue, 22 Mar 2016 17:08:29 +0000 (+0000) Subject: Follow up to r1734656: restore c->data_in_input_filters usage to X-Git-Tag: 2.5.0-alpha~1844 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=239ac0c076a48a8315ddd012f7f8055cba8cf073;p=apache Follow up to r1734656: restore c->data_in_input_filters usage to see if it helps unblocking test framework. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1736216 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/httpd.h b/include/httpd.h index 44a8ac4280..585a89d5e3 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1151,7 +1151,7 @@ struct conn_rec { struct apr_bucket_alloc_t *bucket_alloc; /** The current state of this connection; may be NULL if not used by MPM */ conn_state_t *cs; - /** No longer used, replaced with ap_filter_input_pending() */ + /** Is there data pending in the input filters or connection? */ int data_in_input_filters; /** No longer used, replaced with ap_filter_should_yield() */ int data_in_output_filters; diff --git a/modules/http/http_request.c b/modules/http/http_request.c index 17051eef63..ee50b4232a 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -237,6 +237,7 @@ static void check_pipeline(conn_rec *c, apr_bucket_brigade *bb) apr_size_t cr = 0; char buf[2]; + c->data_in_input_filters = 0; while (c->keepalive != AP_CONN_CLOSE && !c->aborted) { apr_size_t len = cr + 1; @@ -276,6 +277,7 @@ static void check_pipeline(conn_rec *c, apr_bucket_brigade *bb) * where this possible failure comes from (metadata, * morphed EOF socket => empty bucket? debug only here). */ + c->data_in_input_filters = 1; log_level = APLOG_DEBUG; } ap_log_cerror(APLOG_MARK, log_level, rv, c, APLOGNO(02968) @@ -294,6 +296,7 @@ static void check_pipeline(conn_rec *c, apr_bucket_brigade *bb) num_blank_lines--; } else { + c->data_in_input_filters = 1; break; } } @@ -306,6 +309,7 @@ static void check_pipeline(conn_rec *c, apr_bucket_brigade *bb) cr = 1; } else { + c->data_in_input_filters = 1; break; } } @@ -449,7 +453,7 @@ AP_DECLARE(void) ap_process_request(request_rec *r) ap_process_async_request(r); - if (ap_run_input_pending(c) != OK) { + if (!c->data_in_input_filters || ap_run_input_pending(c) != OK) { bb = apr_brigade_create(c->pool, c->bucket_alloc); b = apr_bucket_flush_create(c->bucket_alloc); APR_BRIGADE_INSERT_HEAD(bb, b); diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 8e1e156d40..6648331661 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -1179,7 +1179,7 @@ read_request: listener_may_exit) { cs->pub.state = CONN_STATE_LINGER; } - else if (ap_run_input_pending(c) == OK) { + else if (c->data_in_input_filters || ap_run_input_pending(c) == OK) { cs->pub.state = CONN_STATE_READ_REQUEST_LINE; goto read_request; } diff --git a/server/mpm/motorz/motorz.c b/server/mpm/motorz/motorz.c index 1f5453ef43..c1f90c37ea 100644 --- a/server/mpm/motorz/motorz.c +++ b/server/mpm/motorz/motorz.c @@ -433,7 +433,7 @@ read_request: else if (c->keepalive != AP_CONN_KEEPALIVE || c->aborted) { scon->cs.state = CONN_STATE_LINGER; } - else if (ap_run_input_pending(c) == OK) { + else if (c->data_in_input_filters || ap_run_input_pending(c) == OK) { scon->cs.state = CONN_STATE_READ_REQUEST_LINE; goto read_request; } diff --git a/server/mpm/simple/simple_io.c b/server/mpm/simple/simple_io.c index dcd1c75d84..d06642cb49 100644 --- a/server/mpm/simple/simple_io.c +++ b/server/mpm/simple/simple_io.c @@ -133,7 +133,7 @@ static apr_status_t simple_io_process(simple_conn_t * scon) else if (c->keepalive != AP_CONN_KEEPALIVE || c->aborted) { scon->cs.state = CONN_STATE_LINGER; } - else if (ap_run_input_pending(c) == OK) { + else if (c->data_in_input_filters || ap_run_input_pending(c) == OK) { scon->cs.state = CONN_STATE_READ_REQUEST_LINE; } else { diff --git a/server/util_filter.c b/server/util_filter.c index b3ea895b95..b392ff2722 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -713,9 +713,8 @@ AP_DECLARE(int) ap_filter_prepare_brigade(ap_filter_t *f, apr_pool_t **p) pool = f->r ? f->r->pool : f->c->pool; - key = apr_palloc(pool, sizeof(ap_filter_t **)); - *key = f; - apr_hash_set(f->c->filters, key, sizeof(ap_filter_t **), f); + key = apr_pmemdup(pool, &f, sizeof f); + apr_hash_set(f->c->filters, key, sizeof key, f); f->bb = apr_brigade_create(pool, f->c->bucket_alloc);