tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r697779 - in /tomcat/connectors/trunk/jk: native/common/jk_lb_worker.c native/common/jk_lb_worker.h native/common/jk_shm.h native/common/jk_util.c native/common/jk_util.h xdocs/miscellaneous/changelog.xml
Date Mon, 22 Sep 2008 10:52:16 GMT
Author: mturk
Date: Mon Sep 22 03:52:16 2008
New Revision: 697779

URL: http://svn.apache.org/viewvc?rev=697779&view=rev
Log:
Add session_cookie and session_path directives for load balancer

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h
    tomcat/connectors/trunk/jk/native/common/jk_shm.h
    tomcat/connectors/trunk/jk/native/common/jk_util.c
    tomcat/connectors/trunk/jk/native/common/jk_util.h
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?rev=697779&r1=697778&r2=697779&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Mon Sep 22 03:52:16 2008
@@ -301,6 +301,8 @@
     p->lblock = p->s->lblock;
     p->max_packet_size = p->s->max_packet_size;
     p->sequence = p->s->h.sequence;
+    strncpy(p->session_cookie, p->s->session_cookie, JK_SHM_STR_SIZ);
+    strncpy(p->session_path, p->s->session_path, JK_SHM_STR_SIZ);
 
     for (i = 0; i < p->num_of_workers; i++) {
         lb_sub_worker_t *w = &p->lb_workers[i];
@@ -348,6 +350,8 @@
     p->s->lblock = p->lblock;
     p->s->max_packet_size = p->max_packet_size;
     p->s->h.sequence = p->sequence;
+    strncpy(p->s->session_cookie, p->session_cookie, JK_SHM_STR_SIZ);
+    strncpy(p->s->session_path, p->session_path, JK_SHM_STR_SIZ);
 
     for (i = 0; i < p->num_of_workers; i++) {
         lb_sub_worker_t *w = &p->lb_workers[i];
@@ -468,12 +472,12 @@
 /* Retrieve session id from the cookie or the parameter
  * (parameter first)
  */
-static char *get_sessionid(jk_ws_service_t *s, jk_logger_t *l)
+static char *get_sessionid(jk_ws_service_t *s, lb_worker_t *p, jk_logger_t *l)
 {
     char *val;
-    val = get_path_param(s, JK_PATH_SESSION_IDENTIFIER);
+    val = get_path_param(s, p->session_path);
     if (!val) {
-        val = get_cookie(s, JK_SESSION_IDENTIFIER);
+        val = get_cookie(s, p->session_cookie);
     }
     if (val && !*val) {
         /* TODO: For now only log the empty sessions.
@@ -1070,7 +1074,7 @@
         /* Use sessionid only if sticky_session is
          * defined for this load balancer
          */
-        sessionid = get_sessionid(s, l);
+        sessionid = get_sessionid(s, p->worker, l);
     }
     if (JK_IS_DEBUG_LEVEL(l))
         jk_log(l, JK_LOG_DEBUG,
@@ -1605,6 +1609,14 @@
 
     p->lbmethod = jk_get_lb_method(props, p->name);
     p->lblock   = jk_get_lb_lock(props, p->name);
+    strncpy(p->session_cookie,
+            jk_get_lb_session_cookie(props, p->name, JK_SESSION_IDENTIFIER),
+            JK_SHM_STR_SIZ);
+    strncpy(p->session_path,
+            jk_get_lb_session_path(props, p->name, JK_PATH_SESSION_IDENTIFIER),
+            JK_SHM_STR_SIZ);
+    strcppy(p->s->session_cookie, p->session_cookie);
+    strcppy(p->s->session_path, p->session_path);
 
     JK_INIT_CS(&(p->cs), i);
     if (i == JK_FALSE) {

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h?rev=697779&r1=697778&r2=697779&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h Mon Sep 22 03:52:16 2008
@@ -194,7 +194,10 @@
     int          maintain_time;
     unsigned int max_packet_size;
     unsigned int next_offset;
-
+    /* Session cookie */
+    char         session_cookie[JK_SHM_STR_SIZ+1];
+    /* Session path */
+    char         session_path[JK_SHM_STR_SIZ+1];
 };
 typedef struct lb_worker lb_worker_t;
 

Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_shm.h?rev=697779&r1=697778&r2=697779&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_shm.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.h Mon Sep 22 03:52:16 2008
@@ -165,6 +165,11 @@
     int     lblock;
     unsigned int max_packet_size;
     volatile time_t  last_maintain_time;
+    /* Session cookie */
+    char    session_cookie[JK_SHM_STR_SIZ+1];
+    /* Session path */
+    char    session_path[JK_SHM_STR_SIZ+1];
+
 };
 typedef struct jk_shm_lb_worker jk_shm_lb_worker_t;
 

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?rev=697779&r1=697778&r2=697779&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Mon Sep 22 03:52:16 2008
@@ -69,6 +69,9 @@
 #define BALANCE_WORKERS             ("balance_workers")
 #define STICKY_SESSION              ("sticky_session")
 #define STICKY_SESSION_FORCE        ("sticky_session_force")
+#define SESSION_COOKIE_OF_WORKER    ("session_cookie")
+#define SESSION_PATH_OF_WORKER      ("session_path")
+
 #define LOCAL_WORKER_DEPRECATED     ("local_worker")
 #define LOCAL_WORKER_ONLY_DEPRECATED ("local_worker_only")
 #define JVM_ROUTE_OF_WORKER_DEPRECATED ("jvm_route")
@@ -183,6 +186,8 @@
     LOAD_FACTOR_OF_WORKER,
     STICKY_SESSION,
     STICKY_SESSION_FORCE,
+    SESSION_COOKIE_OF_WORKER,
+    SESSION_PATH_OF_WORKER,
     LOCAL_WORKER_DEPRECATED,
     LOCAL_WORKER_ONLY_DEPRECATED,
     JVM_ROUTE_OF_WORKER_DEPRECATED,
@@ -272,6 +277,8 @@
     BALANCE_WORKERS,
     STICKY_SESSION,
     STICKY_SESSION_FORCE,
+    SESSION_COOKIE_OF_WORKER,
+    SESSION_PATH_OF_WORKER,
     LOCAL_WORKER_DEPRECATED,
     LOCAL_WORKER_ONLY_DEPRECATED,
     JVM_ROUTE_OF_WORKER_DEPRECATED,
@@ -1812,6 +1819,27 @@
     return JK_FALSE;
 }
 
+const char *jk_get_lb_session_cookie(jk_map_t *m, const char *wname, const char *def)
+{
+    char buf[1024];
+    if (!m || !wname) {
+        return NULL;
+    }
+    MAKE_WORKER_PARAM(SESSION_COOKIE_OF_WORKER);
+    return jk_map_get_string(m, buf, def);
+}
+
+const char *jk_get_lb_session_path(jk_map_t *m, const char *wname, const char *def)
+{
+    char buf[1024];
+    if (!m || !wname) {
+        return NULL;
+    }
+    MAKE_WORKER_PARAM(SESSION_PATH_OF_WORKER);
+    return jk_map_get_string(m, buf, def);
+}
+
+
 int is_http_status_fail(unsigned int http_status_fail_num,
                         int *http_status_fail, int status)
 {

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.h?rev=697779&r1=697778&r2=697779&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.h Mon Sep 22 03:52:16 2008
@@ -104,6 +104,10 @@
 
 const char *jk_get_worker_secret_key(jk_map_t *m, const char *wname);
 
+const char *jk_get_lb_session_cookie(jk_map_t *m, const char *wname, const char *def);
+
+const char *jk_get_lb_session_path(jk_map_t *m, const char *wname, const char *def);
+
 int jk_get_worker_retries(jk_map_t *m, const char *wname, int def);
 
 int jk_get_is_worker_disabled(jk_map_t *m, const char *wname);

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?rev=697779&r1=697778&r2=697779&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Mon Sep 22 03:52:16 2008
@@ -43,6 +43,10 @@
   <br />
   <subsection name="Native">
     <changelog>
+      <update>
+        Added session_cookie and session_path for configuring
+        default session identifiers. (mturk)
+      </update>
       <fix>
         <bug>45812</bug>: Add done() service method that
         causes sending EOS bucket for Apache httpd 2.x.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message