]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* mod_proxy_balancer: Allow for treatment of ';' char as a session
authorJim Jagielski <jim@apache.org>
Wed, 17 Sep 2008 14:29:14 +0000 (14:29 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 17 Sep 2008 14:29:14 +0000 (14:29 +0000)
    deliminator/separator, ala mod_jk.
       PR: 45158
           Trunk version of patch:
                  http://svn.apache.org/viewvc?rev=686809&view=rev
                         http://svn.apache.org/viewvc?rev=687754&view=rev
                             Backport version for 2.2.x of patch:
                                    http://people.apache.org/~jim/patches/scolon-proxy.patch.txt
                                        +1: jim, rpluem, jerenkrantz

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@696319 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

diff --git a/CHANGES b/CHANGES
index b5d3d0d5c33f1e8f61ff403689e80b24fae59e7c..1889ae0402bdef48fc87804c9a1be20132857bfa 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,9 @@ Changes with Apache 2.2.10
      mod_proxy_ftp: Prevent XSS attacks when using wildcards in the path of
      the FTP URL. Discovered by Marc Bevand of Rapid7. [Ruediger Pluem]
 
+  *) mod_proxy: Add 'scolonpathdelim' parameter to allow for ';' to also be
+     used as a session path separator/delim  PR 45158. [Jim Jagielski]
+
   *) mod_charset_lite: Avoid dropping error responses by handling meta buckets
      correctly. PR 45687 [Dan Poirier <poirier pobox.com>]
 
index bebe75e275bc0a0adb059a4b96dd22ffda4088df..2b786e3d113a254b752944752fb575f977a6f613 100644 (file)
@@ -838,6 +838,13 @@ expressions</description>
         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>scolonpathdelim</td>
+        <td>Off</td>
+        <td>If set to <code>On</code> the semi-colon character ';' will be
+        used as an additional sticky session path deliminator/separator. This
+        is mainly used to emulate mod_jk's behavior when dealing with paths such
+        as <code>JSESSIONID=6736bcf34;foo=aabfa</code>
+    </td></tr>
     <tr><td>timeout</td>
         <td>0</td>
         <td>Balancer timeout in seconds. If set this will be the maximum time
index 656189df53d7027037fe1937522298c62de73e26..85408f576adf473e32a1897429b3d60247752d93 100644 (file)
  *                     introduce proxy_req_conf.
  * 20051115.16(2.2.9)  Add conn_timeout and conn_timeout_set to
  *                     proxy_worker struct.
+ * 20051115.17(2.2.10) Add scolonsep to proxy_balancer
  *
  */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 16                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 17                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index a6c50242c45c2675579817536ea86f4004cf433c..15e7e8ef80a143085cc2b685b507417c8f836cc6 100644 (file)
@@ -348,6 +348,18 @@ static const char *set_balancer_param(proxy_server_conf *conf,
         }
         return "unknown lbmethod";
     }
+    else if (!strcasecmp(key, "scolonpathdelim")) {
+        /* If set to 'on' then ';' will also be
+         * used as a session path separator/delim (ala
+         * mod_jk)
+         */
+        if (!strcasecmp(val, "on"))
+            balancer->scolonsep = 1;
+        else if (!strcasecmp(val, "off"))
+            balancer->scolonsep = 0;
+        else
+            return "scolonpathdelim must be On|Off";
+    }
     else {
         return "unknown Balancer parameter";
     }
index 2381515c5ddf99875221b228c3749f5702098555..55f64598904f6159084b2aa34dcc98051798839a 100644 (file)
@@ -384,6 +384,7 @@ struct proxy_balancer {
     apr_thread_mutex_t  *mutex;  /* Thread lock for updating lb params */
 #endif
     void            *context;   /* general purpose storage */
+    int             scolonsep;  /* true if ';' seps sticky session paths */
 };
 
 struct proxy_balancer_method {
index e4b2d9a47d6dc23b3668a4d62e2a51ce2f1a67b6..7b6612639facf9f538a0578f65d420771741a69d 100644 (file)
@@ -127,10 +127,14 @@ static int init_balancer_members(proxy_server_conf *conf, server_rec *s,
  * Something like 'JSESSIONID=12345...N'
  */
 static char *get_path_param(apr_pool_t *pool, char *url,
-                            const char *name)
+                            const char *name, int scolon_sep)
 {
     char *path = NULL;
+    char *pathdelims = "?&";
 
+    if (scolon_sep) {
+        pathdelims = ";?&";
+    }
     for (path = strstr(url, name); path; path = strstr(path + 1, name)) {
         path += strlen(name);
         if (*path == '=') {
@@ -140,7 +144,7 @@ static char *get_path_param(apr_pool_t *pool, char *url,
             ++path;
             if (strlen(path)) {
                 char *q;
-                path = apr_strtok(apr_pstrdup(pool, path), "?&", &q);
+                path = apr_strtok(apr_pstrdup(pool, path), pathdelims, &q);
                 return path;
             }
         }
@@ -268,7 +272,7 @@ static proxy_worker *find_session_route(proxy_balancer *balancer,
     
     /* Try to find the sticky route inside url */
     *sticky_used = sticky_path;
-    *route = get_path_param(r->pool, *url, sticky_path);
+    *route = get_path_param(r->pool, *url, sticky_path, balancer->scolonsep);
     if (!*route) {
         *route = get_cookie_param(r, sticky);
         *sticky_used = sticky;