[mod_cluster-commits] mod_cluster SVN: r823 - trunk/native/mod_manager.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Apr 29 09:21:52 EDT 2012


Author: jfrederic.clere at jboss.com
Date: 2012-04-29 09:21:48 -0400 (Sun, 29 Apr 2012)
New Revision: 823

Modified:
   trunk/native/mod_manager/mod_manager.c
Log:
r->handler = "mod-cluster" in trans doesn't work on httpd-2.4.x.


Modified: trunk/native/mod_manager/mod_manager.c
===================================================================
--- trunk/native/mod_manager/mod_manager.c	2012-04-29 08:32:47 UTC (rev 822)
+++ trunk/native/mod_manager/mod_manager.c	2012-04-29 13:21:48 UTC (rev 823)
@@ -1777,31 +1777,11 @@
     x[j] = '\0';
     return j;
 }
-/*
- * This routine is called before mod_proxy translate name.
- * This allows us to make decisions before mod_proxy
- * to be able to fill tables even with ProxyPass / balancer...
- */
-static int manager_trans(request_rec *r)
+
+/* Check that the method is one of ours */
+static int check_method(request_rec *r)
 {
     int ours = 0;
-    core_dir_config *conf =
-        (core_dir_config *)ap_get_module_config(r->per_dir_config,
-                                                &core_module);
-    mod_manager_config *mconf = ap_get_module_config(r->server->module_config,
-                                                     &manager_module);
- 
-    if (conf && conf->handler && r->method_number == M_GET &&
-        strcmp(conf->handler, "mod_cluster-manager") == 0) {
-        r->handler = "mod_cluster-manager";
-        r->filename = apr_pstrdup(r->pool, r->uri);
-        return OK;
-    }
-    if (r->method_number != M_INVALID)
-        return DECLINED;
-    if (!mconf->enable_mcpm_receive)
-        return DECLINED; /* Not allowed to receive MCMP */
-
     if (strcasecmp(r->method, "CONFIG") == 0)
         ours = 1;
     else if (strcasecmp(r->method, "ENABLE-APP") == 0)
@@ -1828,12 +1808,40 @@
         ours = 1;
     else if (strcasecmp(r->method, "QUERY") == 0)
         ours = 1;
+    return ours;
+}
+/*
+ * This routine is called before mod_proxy translate name.
+ * This allows us to make decisions before mod_proxy
+ * to be able to fill tables even with ProxyPass / balancer...
+ */
+static int manager_trans(request_rec *r)
+{
+    int ours = 0;
+    core_dir_config *conf =
+        (core_dir_config *)ap_get_module_config(r->per_dir_config,
+                                                &core_module);
+    mod_manager_config *mconf = ap_get_module_config(r->server->module_config,
+                                                     &manager_module);
+ 
+    if (conf && conf->handler && r->method_number == M_GET &&
+        strcmp(conf->handler, "mod_cluster-manager") == 0) {
+        r->handler = "mod_cluster-manager";
+        r->filename = apr_pstrdup(r->pool, r->uri);
+        return OK;
+    }
+    if (r->method_number != M_INVALID)
+        return DECLINED;
+    if (!mconf->enable_mcpm_receive)
+        return DECLINED; /* Not allowed to receive MCMP */
+
+    ours = check_method(r); 
     if (ours) {
         int i;
         /* The method one of ours */
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "manager_trans %s (%s)", r->method, r->uri);
-        r->handler = "mod-cluster";
+        r->handler = "mod-cluster"; /* that hack doesn't work on httpd-2.4.x */
         i = strlen(r->uri);
         if (strcmp(r->uri, "*") == 0 || (i>=2 && r->uri[i-1] == '*' && r->uri[i-2] == '/')) {
             r->filename = apr_pstrdup(r->pool, NODE_COMMAND);
@@ -2458,6 +2466,7 @@
     apr_size_t bufsiz;
     apr_status_t status;
     int global = 0;
+    int ours = 0;
     char **ptr;
     void *sconf = r->server->module_config;
     mod_manager_config *mconf;
@@ -2469,11 +2478,15 @@
         return(manager_info(r));
     }
 
-    if (strcmp(r->handler, "mod-cluster"))
+    mconf = ap_get_module_config(sconf, &manager_module);
+    if (!mconf->enable_mcpm_receive)
+        return DECLINED; /* Not allowed to receive MCMP */
+
+    ours = check_method(r);
+    if (!ours)
         return DECLINED;
 
     /* Use a buffer to read the message */
-    mconf = ap_get_module_config(sconf, &manager_module);
     if (mconf->maxmesssize)
        bufsiz = mconf->maxmesssize;
     else {



More information about the mod_cluster-commits mailing list