From 0aacd9b39d9dc15844ceb8f2dd9be220d160635d Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Mon, 22 Apr 2013 19:50:25 +0000 Subject: [PATCH] simple MPM: Lift the restriction that prevents mod_ssl taking full advantage of the event MPM. Enable the ability for a module to reverse the sense of a poll event from a read to a write or vice versa. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1470683 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/simple/simple_io.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/server/mpm/simple/simple_io.c b/server/mpm/simple/simple_io.c index 0ba0cee2b2..b14aae474f 100644 --- a/server/mpm/simple/simple_io.c +++ b/server/mpm/simple/simple_io.c @@ -51,9 +51,11 @@ static apr_status_t simple_io_process(simple_conn_t * scon) conn_rec *c; if (scon->c->clogging_input_filters && !scon->c->aborted) { - /* Since we have an input filter which 'cloggs' the input stream, - * like mod_ssl, lets just do the normal read from input filters, - * like the Worker MPM does. + /* Since we have an input filter which 'clogs' the input stream, + * like mod_ssl used to, lets just do the normal read from input + * filters, like the Worker MPM does. Filters that need to write + * where they would otherwise read, or read where they would + * otherwise write, should set the sense appropriately. */ ap_run_process_connection(scon->c); if (scon->cs.state != CONN_STATE_SUSPENDED) { @@ -117,7 +119,10 @@ static apr_status_t simple_io_process(simple_conn_t * scon) timeout : ap_server_conf->timeout, scon->pool); - scon->pfd.reqevents = APR_POLLOUT | APR_POLLHUP | APR_POLLERR; + scon->pfd.reqevents = ( + scon->cs.sense == CONN_SENSE_WANT_READ ? APR_POLLIN : + APR_POLLOUT) | APR_POLLHUP | APR_POLLERR; + scon->cs.sense = CONN_SENSE_DEFAULT; rv = apr_pollcb_add(sc->pollcb, &scon->pfd); @@ -155,7 +160,10 @@ static apr_status_t simple_io_process(simple_conn_t * scon) timeout : ap_server_conf->timeout, scon->pool); - scon->pfd.reqevents = APR_POLLIN; + scon->pfd.reqevents = ( + scon->cs.sense == CONN_SENSE_WANT_WRITE ? APR_POLLOUT : + APR_POLLIN); + scon->cs.sense = CONN_SENSE_DEFAULT; rv = apr_pollcb_add(sc->pollcb, &scon->pfd); @@ -233,6 +241,7 @@ static void *simple_io_setup_conn(apr_thread_t * thread, void *baton) } scon->cs.state = CONN_STATE_READ_REQUEST_LINE; + scon->cs.sense = CONN_SENSE_DEFAULT; rv = simple_io_process(scon); -- 2.40.0