From: Jim Jagielski Date: Fri, 4 Feb 2011 16:11:15 +0000 (+0000) Subject: might as well allow for the sticky session to be adjusted as well... X-Git-Tag: 2.3.11~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85ac0257900c9f77fa4a914cb1633472048951a0;p=thirdparty%2Fapache%2Fhttpd.git might as well allow for the sticky session to be adjusted as well... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1067206 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 09df2826476..516f7e4d421 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -736,7 +736,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog, ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "Doing balancers create: %d, %d", (int)ALIGNED_PROXY_BALANCER_SHARED_SIZE, (int)conf->balancers->nelts); - + rv = storage->create(&new, conf->id, ALIGNED_PROXY_BALANCER_SHARED_SIZE, conf->balancers->nelts, AP_SLOTMEM_TYPE_PREGRAB, pconf); @@ -757,7 +757,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog, balancer->max_workers = balancer->workers->nelts + balancer->growth; /* no need for the 'balancer://' prefix */ - ap_pstr2_alnum(pconf, balancer->name + sizeof(BALANCER_PREFIX) - 1, + ap_pstr2_alnum(pconf, balancer->name + sizeof(BALANCER_PREFIX) - 1, &balancer->sname); balancer->sname = apr_pstrcat(pconf, conf->id, "_", balancer->sname, NULL); @@ -778,7 +778,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog, if ((rv = storage->grab(conf->slot, &index)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "balancer slotmem_grab failed"); return !OK; - + } if ((rv = storage->dptr(conf->slot, index, (void *)&bshm)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "balancer slotmem_dptr failed"); @@ -788,7 +788,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog, ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Cannot share balancer"); return !OK; } - + /* create slotmem slots for workers */ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "Doing workers create: %s (%s), %d, %d", balancer->name, balancer->sname, @@ -989,6 +989,22 @@ static int balancer_handler(request_rec *r) ival = atoi(val); bsel->s->sticky_force = (ival != 0); } + if ((val = apr_table_get(params, "b_ss")) && *val) { + if (strlen(val) < (PROXY_BALANCER_MAX_STICKY_SIZE-1)) { + if (*val == '-' && *(val+1) == '\0') + *bsel->s->sticky_path = *bsel->s->sticky = '\0'; + else { + char *path; + PROXY_STRNCPY(bsel->s->sticky_path, val); + PROXY_STRNCPY(bsel->s->sticky, val); + + if ((path = strchr((char *)bsel->s->sticky, '|'))) { + *path++ = '\0'; + PROXY_STRNCPY(bsel->s->sticky_path, path); + } + } + } + } } if (apr_table_get(params, "xml")) { @@ -1054,7 +1070,7 @@ static int balancer_handler(request_rec *r) } } else { - ap_rputs(" - ", r); + ap_rputs(" (None) ", r); } ap_rprintf(r, "%s\n", balancer->s->sticky_force ? "On" : "Off"); @@ -1162,6 +1178,15 @@ static int balancer_handler(request_rec *r) ap_rprintf(r, "value='%d'>\n", bsel->s->max_attempts); ap_rputs("Disable Failover:", r); create_radio("b_sforce", bsel->s->sticky_force, r); + ap_rputs("Sticky Session:s->sticky, bsel->s->sticky_path)) { + ap_rvputs(r, "value ='", bsel->s->sticky, " | ", + bsel->s->sticky_path, NULL); + } + else { + ap_rvputs(r, "value ='", bsel->s->sticky, NULL); + } + ap_rputs("'> (Use '-' to delete)\n", r); ap_rputs("\n", r); ap_rvputs(r, "\n