From: Paul Querna Date: Tue, 12 Jun 2007 00:32:24 +0000 (+0000) Subject: Add a clogging_input_filters variable to the conn_rec, enabling the Event MPM to... X-Git-Tag: 2.3.0~1776 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83a3e2a77f2da948138b88ec8ce3b9e14e0b6565;p=apache Add a clogging_input_filters variable to the conn_rec, enabling the Event MPM to know when its running with an input filter that buffers its own data, like mod_ssl. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@546328 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 70b3755992..85d652c09d 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] + *) Event MPM: Add support for running under mod_ssl, by reverting to the + Worker MPM behaviors, when run under an input filter that buffers + its own data. [Paul Querna] + *) mod_ssl: Add support for caching SSL Sessions in memcached. [Paul Querna] *) SECURITY: CVE-2007-1862 (cve.mitre.org) diff --git a/include/httpd.h b/include/httpd.h index 601a8aaf34..33037ee3fc 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1081,6 +1081,11 @@ struct conn_rec { int data_in_input_filters; /** Is there data pending in the output filters? */ int data_in_output_filters; + + /** Are there any filters that clogg/buffer the input stream, breaking + * the event mpm. + */ + int clogging_input_filters; }; /** diff --git a/modules/http/http_core.c b/modules/http/http_core.c index e5f109155c..86f042b220 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -119,11 +119,17 @@ static apr_port_t http_port(const request_rec *r) return DEFAULT_HTTP_PORT; } +static int ap_process_http_connection(conn_rec *c); + static int ap_process_http_async_connection(conn_rec *c) { request_rec *r; conn_state_t *cs = c->cs; + if (c->clogging_input_filters) { + return ap_process_http_connection(c); + } + AP_DEBUG_ASSERT(cs->state == CONN_STATE_READ_REQUEST_LINE); while (cs->state == CONN_STATE_READ_REQUEST_LINE) { diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c index 5c667d7682..0500932c95 100644 --- a/modules/ssl/ssl_engine_io.c +++ b/modules/ssl/ssl_engine_io.c @@ -1665,6 +1665,9 @@ void ssl_io_filter_init(conn_rec *c, SSL *ssl) filter_ctx->pbioWrite = BIO_new(&bio_filter_out_method); filter_ctx->pbioWrite->ptr = (void *)bio_filter_out_ctx_new(filter_ctx, c); + /* We insert a clogging input filter. Let the core know. */ + c->clogging_input_filters = 1; + ssl_io_input_add_filter(filter_ctx, c, ssl); SSL_set_bio(ssl, filter_ctx->pbioRead, filter_ctx->pbioWrite); diff --git a/server/core.c b/server/core.c index 46ff1446e0..6e163eca11 100644 --- a/server/core.c +++ b/server/core.c @@ -3803,6 +3803,7 @@ static conn_rec *core_create_conn(apr_pool_t *ptrans, server_rec *server, c->cs->c = c; c->cs->p = ptrans; c->cs->bucket_alloc = alloc; + c->clogging_input_filters = 0; return c; } diff --git a/server/mpm/experimental/event/event.c b/server/mpm/experimental/event/event.c index 417f360cc1..37ded5afb7 100644 --- a/server/mpm/experimental/event/event.c +++ b/server/mpm/experimental/event/event.c @@ -620,6 +620,16 @@ static int process_socket(apr_pool_t * p, apr_socket_t * sock, pt = cs->pfd.client_data; } + if (c->clogging_input_filters && !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. + */ + ap_run_process_connection(c); + ap_lingering_close(c); + return 0; + } + read_request: if (cs->state == CONN_STATE_READ_REQUEST_LINE) { if (!c->aborted) {