]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Allow for setting of sticky session split char...
authorJim Jagielski <jim@apache.org>
Thu, 1 Nov 2012 16:06:43 +0000 (16:06 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 1 Nov 2012 16:06:43 +0000 (16:06 +0000)
Bugz 53893

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1404653 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_proxy.xml
include/ap_mmn.h
modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h
modules/proxy/mod_proxy_balancer.c
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index 1b7a430c3c730282877df9b31b280bf36219e9f7..664e780629f3c1ad881ec4f22d0b7da1b1dc82b5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy: Add ability to configure the sticky session separator.
+     PR 53893. [<inu inusasha de>, Jim Jagielski]
+
   *) mod_proxy_ftp: Fix segfaults on IPv4 requests to hosts with DNS AAAA records.
-     PR  40841. [Andrew Rucker Jones <arjones simultan dyndns org>,
+     PR 40841. [Andrew Rucker Jones <arjones simultan dyndns org>,
      <ast domdv de>, Jim Jagielski]
 
   *) ap_expr: Add req_novary function that allows HTTP header lookups
index 56def6edd023f769687f0b984405c19f8181d278..63b1fa7964cfff5039e7f2b30837adcaf639c395 100644 (file)
@@ -1092,6 +1092,13 @@ ProxyPass /mirror/foo http://backend.example.com
         and url encoded id (like servlet containers) use | to to separate them.
         The first part is for the cookie the second for the path.
     </td></tr>
+    <tr><td>stickysessionsep</td>
+        <td>"."</td>
+        <td>Sets the separation symbol in the session cookie. Some backend application servers
+        do not use the '.' as the symbol. For example the Oracle Weblogic server uses 
+        '!'. The correct symbol can be set using this option. The setting of 'Off'
+        signifies that no symbol is used.
+    </td></tr>
     <tr><td>scolonpathdelim</td>
         <td>Off</td>
         <td>If set to <code>On</code> the semi-colon character ';' will be
index 69e580215c85f056d80a6f9107334f38049721ee..74dab7c32a576c935dba290e2ea77002e8de2b44 100644 (file)
  * 20120724.3 (2.5.0-dev)  Add bal_persist, inherit to proxy_server_conf
  * 20120724.4 (2.5.0-dev)  Add dirwalk_stat hook.
  * 20120724.5 (2.5.0-dev)  Add ap_get_sload() and ap_get_loadavg().
+ * 20120724.6 (2.5.0-dev)  Add sticky_separator to proxy_balancer_shared struct.
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20120724
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 5                   /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 6                   /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index e364d5526ede17b841a06063d85143ffbcce86a4..25040e738b8a7dfe31f6cc79a0cf8398503180de 100644 (file)
@@ -287,6 +287,19 @@ static const char *set_balancer_param(proxy_server_conf *conf,
             PROXY_STRNCPY(balancer->s->sticky_path, path);
         }
     }
+    else if (!strcasecmp(key, "stickysessionsep")) {
+        /* separator/delimiter for sessionid and route,
+         * normally '.'
+         */
+        if (strlen(val) != 1) {
+            if (!strcasecmp(val, "off"))
+                balancer->s->sticky_separator = 0;
+            else      
+                return "stickysessionsep must be a single character or Off";
+        }
+        else
+            balancer->s->sticky_separator = *val;
+    }
     else if (!strcasecmp(key, "nofailover")) {
         /* If set to 'on' the session will break
          * if the worker is in error state or
index 9fd18d8f189fd319c3ed56c33bc732a17bad99c2..15524c64a5345beb8af6b1fb6fd5ab4029bcd037 100644 (file)
@@ -419,6 +419,7 @@ typedef struct {
     int             max_attempts;     /* Number of attempts before failing */
     int             index;      /* shm array index */
     proxy_hashes hash;
+    char      sticky_separator;                                /* separator for sessionid/route */
     unsigned int    sticky_force:1;   /* Disable failover for sticky sessions */
     unsigned int    scolonsep:1;      /* true if ';' seps sticky session paths */
     unsigned int    max_attempts_set:1;
index dec145e5a3649fbb5c179bdcd1c2c14fc5d9716a..78a00d3dc5687a60e71b2afd5ca1ef895adb4f9b 100644 (file)
@@ -293,10 +293,11 @@ static proxy_worker *find_session_route(proxy_balancer *balancer,
         }
     }
     /*
-     * If we found a value for sticksession, find the first '.' within.
-     * Everything after '.' (if present) is our route.
+     * If we found a value for stickysession, find the first '.' (or whatever
+     * sticky_separator is set to) within. Everything after '.' (if present)
+     * is our route. 
      */
-    if ((*route) && ((*route = strchr(*route, '.')) != NULL ))
+    if ((*route) && (balancer->s->sticky_separator != 0) && ((*route = strchr(*route, balancer->s->sticky_separator)) != NULL ))
         (*route)++;
     if ((*route) && (**route)) {
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01161) "Found route %s", *route);
index ce81b19e3bf4b5fafceb51c8e8034963a0f834e4..e462334f78e8692c0b0677ef780ffe1e39ac8be4 100644 (file)
@@ -1182,6 +1182,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
     (*balancer)->hash = bshared->hash;
 
     bshared->forcerecovery = 1;
+    bshared->sticky_separator = '.';
     *bshared->nonce = PROXY_UNSET_NONCE;  /* impossible valid input */
 
     (*balancer)->s = bshared;