You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2008/09/17 16:29:16 UTC

svn commit: r696319 - in /httpd/httpd/branches/2.2.x: 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

Author: jim
Date: Wed Sep 17 07:29:14 2008
New Revision: 696319

URL: http://svn.apache.org/viewvc?rev=696319&view=rev
Log:
 * mod_proxy_balancer: Allow for treatment of ';' char as a session
    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



Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml
    httpd/httpd/branches/2.2.x/include/ap_mmn.h
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=696319&r1=696318&r2=696319&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Wed Sep 17 07:29:14 2008
@@ -5,6 +5,9 @@
      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>]
 

Modified: httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml?rev=696319&r1=696318&r2=696319&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml Wed Sep 17 07:29:14 2008
@@ -838,6 +838,13 @@
         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

Modified: httpd/httpd/branches/2.2.x/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/ap_mmn.h?rev=696319&r1=696318&r2=696319&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.2.x/include/ap_mmn.h Wed Sep 17 07:29:14 2008
@@ -130,6 +130,7 @@
  *                     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
  *
  */
 
@@ -138,7 +139,7 @@
 #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

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c?rev=696319&r1=696318&r2=696319&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c Wed Sep 17 07:29:14 2008
@@ -348,6 +348,18 @@
         }
         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";
     }

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h?rev=696319&r1=696318&r2=696319&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h Wed Sep 17 07:29:14 2008
@@ -384,6 +384,7 @@
     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 {

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c?rev=696319&r1=696318&r2=696319&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c Wed Sep 17 07:29:14 2008
@@ -127,10 +127,14 @@
  * 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 @@
             ++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 @@
     
     /* 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;