You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2009/04/02 12:05:39 UTC
svn commit: r761226 - in /httpd/httpd/trunk/modules: http/http_core.c
proxy/mod_serf.c
Author: trawick
Date: Thu Apr 2 10:05:39 2009
New Revision: 761226
URL: http://svn.apache.org/viewvc?rev=761226&view=rev
Log:
handle an unfortunate implication of loadable MPMs:
calls to ap_mpm_query() must be deferred until after the register-hooks hook, since that's
where the MPM registers its mpm-query hook
Modified:
httpd/httpd/trunk/modules/http/http_core.c
httpd/httpd/trunk/modules/proxy/mod_serf.c
Modified: httpd/httpd/trunk/modules/http/http_core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_core.c?rev=761226&r1=761225&r2=761226&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_core.c (original)
+++ httpd/httpd/trunk/modules/http/http_core.c Thu Apr 2 10:05:39 2009
@@ -41,8 +41,10 @@
AP_DECLARE_DATA ap_filter_rec_t *ap_http_outerror_filter_handle;
AP_DECLARE_DATA ap_filter_rec_t *ap_byterange_filter_handle;
-static int ap_process_http_connection(conn_rec *c);
-
+/* If we are using an MPM That Supports Async Connections,
+ * use a different processing function
+ */
+static int async_mpm = 0;
static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
const char *arg)
@@ -130,10 +132,6 @@
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) {
@@ -172,7 +170,7 @@
return OK;
}
-static int ap_process_http_connection(conn_rec *c)
+static int ap_process_http_sync_connection(conn_rec *c)
{
request_rec *r;
conn_state_t *cs = c->cs;
@@ -228,6 +226,16 @@
return OK;
}
+static int ap_process_http_connection(conn_rec *c)
+{
+ if (async_mpm && !c->clogging_input_filters) {
+ return ap_process_http_async_connection(c);
+ }
+ else {
+ return ap_process_http_sync_connection(c);
+ }
+}
+
static int http_create_request(request_rec *r)
{
if (!r->main && !r->prev) {
@@ -253,23 +261,19 @@
return DECLINED;
}
-static void register_hooks(apr_pool_t *p)
+static int http_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
{
- /**
- * If we ae using an MPM That Supports Async Connections,
- * use a different processing function
- */
- int async_mpm = 0;
- if (ap_mpm_query(AP_MPMQ_IS_ASYNC, &async_mpm) == APR_SUCCESS
- && async_mpm == 1) {
- ap_hook_process_connection(ap_process_http_async_connection, NULL,
- NULL, APR_HOOK_REALLY_LAST);
- }
- else {
- ap_hook_process_connection(ap_process_http_connection, NULL, NULL,
- APR_HOOK_REALLY_LAST);
+ if (ap_mpm_query(AP_MPMQ_IS_ASYNC, &async_mpm) != APR_SUCCESS) {
+ async_mpm = 0;
}
+ return OK;
+}
+static void register_hooks(apr_pool_t *p)
+{
+ ap_hook_post_config(http_post_config, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_process_connection(ap_process_http_connection, NULL, NULL,
+ APR_HOOK_REALLY_LAST);
ap_hook_map_to_storage(ap_send_http_trace,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_map_to_storage(http_send_options,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_http_scheme(http_scheme,NULL,NULL,APR_HOOK_REALLY_LAST);
Modified: httpd/httpd/trunk/modules/proxy/mod_serf.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_serf.c?rev=761226&r1=761225&r2=761226&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_serf.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_serf.c Thu Apr 2 10:05:39 2009
@@ -1079,7 +1079,7 @@
NULL
};
-static void register_hooks(apr_pool_t *p)
+static int serf_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
{
apr_status_t rv;
rv = ap_mpm_query(AP_MPMQ_HAS_SERF, &mpm_supprts_serf);
@@ -1088,12 +1088,19 @@
mpm_supprts_serf = 0;
}
+ return OK;
+}
+
+static void register_hooks(apr_pool_t *p)
+{
ap_register_provider(p, AP_SERF_CLUSTER_PROVIDER,
"heartbeat", "0", &builtin_heartbeat);
ap_register_provider(p, AP_SERF_CLUSTER_PROVIDER,
"static", "0", &builtin_static);
+ ap_hook_post_config(serf_post_config, NULL, NULL, APR_HOOK_MIDDLE);
+
ap_hook_handler(serf_handler, NULL, NULL, APR_HOOK_FIRST);
}