ps->reverse = NULL;
ps->domain = NULL;
#if 0
- id = ap_proxy_hashfunc(apr_psprintf(p, "%pp-%" APR_TIME_T_FMT, ps->noproxies, apr_time_now()), PROXY_HASHFUNC_DEFAULT);
+ id = ap_proxy_hashfunc(apr_psprintf(p, "%pp-%" APR_TIME_T_FMT, ps, apr_time_now()), PROXY_HASHFUNC_DEFAULT);
#else
- id = ap_proxy_hashfunc(apr_psprintf(p, "%pp", ps->noproxies), PROXY_HASHFUNC_DEFAULT);
+ id = ap_proxy_hashfunc(apr_psprintf(p, "%pp", ps), PROXY_HASHFUNC_DEFAULT);
#endif
- ps->id = apr_psprintf(p, "cnf_%x", id);
+ ps->id = apr_psprintf(p, "s%x", id);
ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
ps->viaopt_set = 0; /* 0 means default */
ps->req = 0;
"<tr><th>Stat</th><td>Worker status</td></tr>\n"
"<tr><th>Route</th><td>Session Route</td></tr>\n"
"<tr><th>Redir</th><td>Session Route Redirection</td></tr>\n"
- "<tr><th>F</th><td>Load Balancer Factor in %</td></tr>\n"
- "<tr><th>Acc</th><td>Number of requests</td></tr>\n"
+ "<tr><th>F</th><td>Load Balancer Factor</td></tr>\n"
+ "<tr><th>Acc</th><td>Number of uses</td></tr>\n"
"<tr><th>Wr</th><td>Number of bytes transferred</td></tr>\n"
"<tr><th>Rd</th><td>Number of bytes read</td></tr>\n"
"</table>", r);
unsigned int index;
balancer->max_workers = balancer->workers->nelts + balancer->growth;
- ap_pstr2_alnum(pconf, balancer->name, &balancer->sname);
+ /* no need for the 'balancer://' prefix */
+ ap_pstr2_alnum(pconf, balancer->name + sizeof(BALANCER_PREFIX) - 1,
+ &balancer->sname);
+ balancer->sname = apr_pstrcat(pconf, conf->id, "_", balancer->sname, NULL);
/* Create global mutex */
rv = ap_global_mutex_create(&(balancer->mutex), NULL, balancer_mutex_type,
apr_table_t *params;
int access_status;
int i, n;
+ int ok2change = 1;
const char *name;
/* is this for us? */
)
) {
apr_table_clear(params);
+ ok2change = 0;
}
/* First set the params */
- /*
- * Note that it is not possible set the proxy_balancer because it is not
- * in shared memory.
- */
- if (wsel) {
+ if (wsel && ok2change) {
const char *val;
if ((val = apr_table_get(params, "lf"))) {
int ival = atoi(val);
}
}
+
+ if (bsel && ok2change) {
+ const char *val;
+ if ((val = apr_table_get(params, "lbm"))) {
+ proxy_balancer_method *lbmethod;
+ lbmethod = ap_lookup_provider(PROXY_LBMETHOD, val, "0");
+ if (lbmethod)
+ bsel->s->lbmethod = lbmethod;
+ }
+ }
+
if (apr_table_get(params, "xml")) {
ap_set_content_type(r, "text/xml");
ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n", r);
for (i = 0; i < conf->balancers->nelts; i++) {
ap_rputs("<hr />\n<h3>LoadBalancer Status for ", r);
- ap_rvputs(r, balancer->name, "</h3>\n\n", NULL);
+ ap_rvputs(r, "<a href=\"", r->uri, "?b=",
+ balancer->name + sizeof(BALANCER_PREFIX) - 1,
+ "&nonce=", balancer->s->nonce,
+ "\">", NULL);
+ ap_rvputs(r, balancer->name, "</a></h3>\n\n", NULL);
ap_rputs("\n\n<table border=\"0\" style=\"text-align: left;\"><tr>"
"<th>MaxMembers</th><th>StickySession</th><th>Timeout</th><th>FailoverAttempts</th><th>Method</th>"
"</tr>\n<tr>", r);
bsel->s->nonce, "\">\n", NULL);
ap_rvputs(r, "</form>\n", NULL);
ap_rputs("<hr />\n", r);
+ } else if (bsel) {
+ const apr_array_header_t *provs;
+ const ap_list_provider_names_t *pname;
+ int i;
+ ap_rputs("<h3>Edit balancer settings for ", r);
+ ap_rvputs(r, bsel->name, "</h3>\n", NULL);
+ ap_rvputs(r, "<form method=\"GET\" action=\"", NULL);
+ ap_rvputs(r, r->uri, "\">\n<dl>\n<table>\n", NULL);
+ provs = ap_list_provider_names(r->pool, PROXY_LBMETHOD, "0");
+ if (provs) {
+ ap_rputs("<tr><td>LBmethod:</td>", r);
+ ap_rputs("<td>\n<select name=\"lbm\" id=\"lbm\">", r);
+ pname = (ap_list_provider_names_t *)provs->elts;
+ for (i = 0; i < provs->nelts; i++, pname++) {
+ ap_rvputs(r,"<option value=\"", pname->provider_name, "\"", NULL);
+ if (strcmp(pname->provider_name, bsel->s->lbmethod->name) == 0)
+ ap_rputs(" selected ", r);
+ ap_rvputs(r, ">", pname->provider_name, "\n", NULL);
+ }
+ ap_rputs("</select>\n</td></tr>\n", r);
+ }
+ ap_rputs("</td></tr>\n", r);
+ ap_rputs("<tr><td colspan=2><input type=submit value=\"Submit\"></td></tr>\n", r);
+ ap_rvputs(r, "</table>\n<input type=hidden name=\"b\" ", NULL);
+ ap_rvputs(r, "value=\"", bsel->name + sizeof(BALANCER_PREFIX) - 1,
+ "\">\n", NULL);
+ ap_rvputs(r, "<input type=hidden name=\"nonce\" value=\"",
+ bsel->s->nonce, "\">\n", NULL);
+ ap_rvputs(r, "</form>\n", NULL);
+ ap_rputs("<hr />\n", r);
}
ap_rputs(ap_psignature("",r), r);
ap_rputs("</body></html>\n", r);
- }
+}
return OK;
}