Author: jfrederic.clere(a)jboss.com
Date: 2009-07-21 06:58:50 -0400 (Tue, 21 Jul 2009)
New Revision: 2500
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Fix for MODCLUSTER-77
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-07-21 10:09:50 UTC
(rev 2499)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-07-21 10:58:50 UTC
(rev 2500)
@@ -81,6 +81,8 @@
#define CREAT_ROOT 2 /* Only create balancers/workers in the main server */
static int creat_bal = CREAT_ROOT;
+static int use_alias = 0; /* 1 : Compare Alias with server_name */
+
#define WAITFORREMOVE 10 /* seconds */
#define TIMEINTERVAL apr_time_from_sec(1) /* recalcul the lbstatus based on number of
request in the time interval */
@@ -834,7 +836,15 @@
hostinfo_t *vhost;
host_storage->read_host(vhosts[i], &vhost);
if (vhost->node == node->mess.id) {
- /* XXX Check the virtual host */
+ /* Check the virtual host */
+ if (use_alias) {
+#if HAVE_CLUSTER_EX_DEBUG
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "get_balancer_by_node testing ServerName: %s host:
%s", ap_get_server_name(r), vhost->host);
+#endif
+ if (strcmp(ap_get_server_name(r), vhost->host) != 0)
+ continue;
+ }
/* Check the contexts */
int j;
@@ -2276,6 +2286,17 @@
return NULL;
}
+static const char*cmd_proxy_cluster_use_alias(cmd_parms *cmd, void *dummy, const char
*arg)
+{
+ int val = atoi(arg);
+ if (val<0 || val>1) {
+ return "UseAlias must be one of: 0 or 1";
+ } else {
+ use_alias = val;
+ }
+ return NULL;
+}
+
static const command_rec proxy_cluster_cmds[] =
{
AP_INIT_TAKE1(
@@ -2285,6 +2306,13 @@
OR_ALL,
"CreateBalancers - Defined VirtualHosts where the balancers are created 0:
All, 1: None, 2: Main (Default: 2 Main)"
),
+ AP_INIT_TAKE1(
+ "UseAlias",
+ cmd_proxy_cluster_use_alias,
+ NULL,
+ OR_ALL,
+ "UseAlias - Check that the Alias corresponds to the ServerName 0: Don't
(ignore Aliases), 1: Check it (Default: 0 Ignore)"
+ ),
{NULL}
};
Show replies by date