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 2012/09/17 14:22:34 UTC

svn commit: r1386578 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

Author: jim
Date: Mon Sep 17 12:22:33 2012
New Revision: 1386578

URL: http://svn.apache.org/viewvc?rev=1386578&view=rev
Log:
Don't just willy nilly slurp double slashes... just handle
the end-case where a '//' is not intended (due to how
PPR is stored)

Modified:
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1386578&r1=1386577&r2=1386578&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon Sep 17 12:22:33 2012
@@ -859,7 +859,6 @@ PROXY_DECLARE(const char *) ap_proxy_loc
         if (ap_proxy_valid_balancer_name((char *)real, 0) &&
             (balancer = ap_proxy_get_balancer(r->pool, sconf, real, 1))) {
             int n, l3 = 0;
-            int fake_endwslash = (ent[i].fake[strlen(ent[i].fake)-1] == '/');
             proxy_worker **worker = (proxy_worker **)balancer->workers->elts;
             const char *urlpart = ap_strchr_c(real + sizeof(BALANCER_PREFIX) - 1, '/');
             if (urlpart) {
@@ -882,21 +881,18 @@ PROXY_DECLARE(const char *) ap_proxy_loc
                     if (l1 >= l2 + l3
                             && strncasecmp((*worker)->s->name, url, l2) == 0
                             && strncmp(urlpart, url + l2, l3) == 0) {
-                        /* Avoid double-slash when concatting */
-                        if (fake_endwslash && (url[l2 + l3] == '/')) {
-                            l2++;
-                        }
                         u = apr_pstrcat(r->pool, ent[i].fake, &url[l2 + l3],
                                         NULL);
                         return ap_is_url(u) ? u : ap_construct_url(r->pool, u, r);
                     }
                 }
                 else if (l1 >= l2 && strncasecmp((*worker)->s->name, url, l2) == 0) {
-                    /* Avoid double-slash when concatting */
-                    if (fake_endwslash && (url[l2] == '/')) {
-                        l2++;
+                    /* edge case where fake is just "/"... avoid double slash */
+                    if ((ent[i].fake[0] == '/') && (ent[i].fake[1] == 0) && (url[l2] == '/')) {
+                        u = apr_pstrdup(r->pool, &url[l2]);
+                    } else {
+                        u = apr_pstrcat(r->pool, ent[i].fake, &url[l2], NULL);
                     }
-                    u = apr_pstrcat(r->pool, ent[i].fake, &url[l2], NULL);
                     return ap_is_url(u) ? u : ap_construct_url(r->pool, u, r);
                 }
                 worker++;