Author: jfrederic.clere(a)jboss.com
Date: 2009-03-07 06:46:26 -0500 (Sat, 07 Mar 2009)
New Revision: 2343
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Deactivate sessionid storing by default.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-03-07 10:05:30 UTC (rev 2342)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-03-07 11:46:26 UTC (rev 2343)
@@ -54,7 +54,7 @@
#define DEFMAXCONTEXT 100
#define DEFMAXNODE 20
#define DEFMAXHOST 20
-#define DEFMAXSESSIONID 512
+#define DEFMAXSESSIONID 0 /* it has performance/security impact */
#define MAXMESSSIZE 1024
/* Error messages */
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 10:05:30 UTC
(rev 2342)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 11:46:26 UTC
(rev 2343)
@@ -1259,7 +1259,8 @@
/* Calculate the lbstatus for each node */
update_workers_lbstatus(conf, pool, s);
/* Free sessionid slots */
- remove_timeout_sessionid(conf, pool, s);
+ if (sessionid_storage)
+ remove_timeout_sessionid(conf, pool, s);
apr_pool_destroy(pool);
}
apr_thread_exit(thd, 0);
@@ -1330,6 +1331,10 @@
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s,
"proxy_cluster_post_config: Can't find mod_manager for
sessionids");
return !OK;
+ } else {
+ int nb_sessionid = sessionid_storage->get_max_size_sessionid();
+ if (! nb_sessionid)
+ sessionid_storage = NULL; /* don't use it */
}
return OK;
@@ -1375,7 +1380,8 @@
#endif
/* here we have the route and domain for find_session_route ...
*/
apr_table_setn(r->notes, "session-sticky",
sticky_used);
- apr_table_setn(r->notes, "session-id", sessionid);
+ if (sessionid_storage)
+ apr_table_setn(r->notes, "session-id",
sessionid);
apr_table_setn(r->notes, "session-route", route);
apr_table_setn(r->subprocess_env,
"BALANCER_SESSION_ROUTE", route);
@@ -1896,7 +1902,6 @@
proxy_server_conf *conf)
{
- apr_status_t rv;
proxy_cluster_helper *helper;
const char *sessionid;
const char *route;
@@ -1916,40 +1921,43 @@
if (worker && worker->s->busy)
worker->s->busy--;
- /* Add information about sessions corresponding to a node */
- sticky = apr_table_get(r->notes, "session-sticky");
- if (sticky == NULL) {
- char *path, *stick;
- stick = apr_pstrdup(r->pool, balancer->sticky);
- if ((path = strchr(stick, '|'))) {
- *path++ = '\0';
+ if (sessionid_storage) {
+
+ /* Add information about sessions corresponding to a node */
+ sticky = apr_table_get(r->notes, "session-sticky");
+ if (sticky == NULL) {
+ char *path, *stick;
+ stick = apr_pstrdup(r->pool, balancer->sticky);
+ if ((path = strchr(stick, '|'))) {
+ *path++ = '\0';
+ }
+ sticky = (const char *) stick;
}
- sticky = (const char *) stick;
- }
- cookie = get_cookie_param(r, sticky, 0);
- sessionid = apr_table_get(r->notes, "session-id");
- route = apr_table_get(r->notes, "session-route");
- if (cookie) {
- if (sessionid && strcmp(cookie, sessionid)) {
- /* The cookie has changed, remove the old one and store the next one */
+ cookie = get_cookie_param(r, sticky, 0);
+ sessionid = apr_table_get(r->notes, "session-id");
+ route = apr_table_get(r->notes, "session-route");
+ if (cookie) {
+ if (sessionid && strcmp(cookie, sessionid)) {
+ /* The cookie has changed, remove the old one and store the next one */
+ sessionidinfo_t ou;
+ strncpy(ou.sessionid, sessionid, SESSIONIDSZ);
+ ou.id = 0;
+ sessionid_storage->remove_sessionid(&ou);
+ }
+ if ((oroute = strchr(cookie, '.')) != NULL )
+ oroute++;
+ route = oroute;
+ sessionid = cookie;
+ }
+
+ if (sessionid && route) {
sessionidinfo_t ou;
strncpy(ou.sessionid, sessionid, SESSIONIDSZ);
- ou.id = 0;
- sessionid_storage->remove_sessionid(&ou);
+ strncpy(ou.JVMRoute, route, JVMROUTESZ);
+ sessionid_storage->insert_update_sessionid(&ou);
}
- if ((oroute = strchr(cookie, '.')) != NULL )
- oroute++;
- route = oroute;
- sessionid = cookie;
}
- if (sessionid && route) {
- sessionidinfo_t ou;
- strncpy(ou.sessionid, sessionid, SESSIONIDSZ);
- strncpy(ou.JVMRoute, route, JVMROUTESZ);
- sessionid_storage->insert_update_sessionid(&ou);
- }
-
return OK;
}