httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1386576 - /httpd/httpd/trunk/modules/proxy/proxy_util.c
Date Mon, 17 Sep 2012 12:11:46 GMT
Author: jim
Date: Mon Sep 17 12:11:45 2012
New Revision: 1386576

URL: http://svn.apache.org/viewvc?rev=1386576&view=rev
Log:
When concatting for PPR, avoid cases where we
concat ".../" and "/..." to create "...//..."

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=1386576&r1=1386575&r2=1386576&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon Sep 17 12:11:45 2012
@@ -859,6 +859,7 @@ 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) {
@@ -881,12 +882,20 @@ 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++;
+                    }
                     u = apr_pstrcat(r->pool, ent[i].fake, &url[l2], NULL);
                     return ap_is_url(u) ? u : ap_construct_url(r->pool, u, r);
                 }



Mime
View raw message