Lines 234-249
Link Here
|
234 |
static proxy_worker *find_session_route(proxy_balancer *balancer, |
234 |
static proxy_worker *find_session_route(proxy_balancer *balancer, |
235 |
request_rec *r, |
235 |
request_rec *r, |
236 |
char **route, |
236 |
char **route, |
|
|
237 |
char **sticky_used, |
237 |
char **url) |
238 |
char **url) |
238 |
{ |
239 |
{ |
239 |
proxy_worker *worker = NULL; |
240 |
proxy_worker *worker = NULL; |
|
|
241 |
char *sticky, *sticky_path, *path; |
240 |
|
242 |
|
241 |
if (!balancer->sticky) |
243 |
if (!balancer->sticky) |
242 |
return NULL; |
244 |
return NULL; |
|
|
245 |
sticky = sticky_path = apr_pstrdup(r->pool, balancer->sticky); |
246 |
if ((path = strchr(sticky, '|'))) { |
247 |
*path++ = '\0'; |
248 |
sticky_path = path; |
249 |
} |
250 |
|
243 |
/* Try to find the sticky route inside url */ |
251 |
/* Try to find the sticky route inside url */ |
244 |
*route = get_path_param(r->pool, *url, balancer->sticky); |
252 |
*sticky_used = sticky_path; |
245 |
if (!*route) |
253 |
*route = get_path_param(r->pool, *url, sticky_path); |
246 |
*route = get_cookie_param(r, balancer->sticky); |
254 |
if (!*route) { |
|
|
255 |
*route = get_cookie_param(r, sticky); |
256 |
*sticky_used = sticky; |
257 |
} |
247 |
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, |
258 |
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, |
248 |
"proxy: BALANCER: Found value %s for " |
259 |
"proxy: BALANCER: Found value %s for " |
249 |
"stickysession %s", *route, balancer->sticky); |
260 |
"stickysession %s", *route, balancer->sticky); |
Lines 369-374
Link Here
|
369 |
int access_status; |
380 |
int access_status; |
370 |
proxy_worker *runtime; |
381 |
proxy_worker *runtime; |
371 |
char *route = NULL; |
382 |
char *route = NULL; |
|
|
383 |
char *sticky = NULL; |
372 |
apr_status_t rv; |
384 |
apr_status_t rv; |
373 |
|
385 |
|
374 |
*worker = NULL; |
386 |
*worker = NULL; |
Lines 383-389
Link Here
|
383 |
|
395 |
|
384 |
/* Step 2: find the session route */ |
396 |
/* Step 2: find the session route */ |
385 |
|
397 |
|
386 |
runtime = find_session_route(*balancer, r, &route, url); |
398 |
runtime = find_session_route(*balancer, r, &route, &sticky, url); |
387 |
/* Lock the LoadBalancer |
399 |
/* Lock the LoadBalancer |
388 |
* XXX: perhaps we need the process lock here |
400 |
* XXX: perhaps we need the process lock here |
389 |
*/ |
401 |
*/ |
Lines 476-487
Link Here
|
476 |
access_status = rewrite_url(r, *worker, url); |
488 |
access_status = rewrite_url(r, *worker, url); |
477 |
/* Add the session route to request notes if present */ |
489 |
/* Add the session route to request notes if present */ |
478 |
if (route) { |
490 |
if (route) { |
479 |
apr_table_setn(r->notes, "session-sticky", (*balancer)->sticky); |
491 |
apr_table_setn(r->notes, "session-sticky", sticky); |
480 |
apr_table_setn(r->notes, "session-route", route); |
492 |
apr_table_setn(r->notes, "session-route", route); |
481 |
|
493 |
|
482 |
/* Add session info to env. */ |
494 |
/* Add session info to env. */ |
483 |
apr_table_setn(r->subprocess_env, |
495 |
apr_table_setn(r->subprocess_env, |
484 |
"BALANCER_SESSION_STICKY", (*balancer)->sticky); |
496 |
"BALANCER_SESSION_STICKY", sticky); |
485 |
apr_table_setn(r->subprocess_env, |
497 |
apr_table_setn(r->subprocess_env, |
486 |
"BALANCER_SESSION_ROUTE", route); |
498 |
"BALANCER_SESSION_ROUTE", route); |
487 |
} |
499 |
} |