]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport 330085
authorJim Jagielski <jim@apache.org>
Tue, 8 Nov 2005 13:15:17 +0000 (13:15 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 8 Nov 2005 13:15:17 +0000 (13:15 +0000)
Fix worker and URL matching to be case sensitive
when needed.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@331811 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index 6be983d3828a63a5a650b384f2929c768eb4a6ed..ffcd33eefda5434ed527bae7ad0f0bc776d9111b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.1.10
 
+  *) mod_proxy_balancer: When finding best worker, use case insensitive
+     match for scheme and host, but case sensitive for the rest of
+     the path. [Jim Jagielski, Ruediger Pluem]
+
   *) Require use of APR >= 1.2.0 and APR-util >= 1.2.0 when configured 
      to use external copies of the libraries.  [Joe Orton] 
 
index b78d019708b38af06be1b9e11c9cea94b7970f4f..0fb499be5dda1674e5d29ff104fef9a185296791 100644 (file)
@@ -1217,13 +1217,33 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
     int url_length;
     int worker_name_length;
     const char *c;
+    char *url_copy;
     int i;
 
     c = ap_strchr_c(url, ':');
     if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0')
        return NULL;
 
+    url_copy = apr_pstrdup(p, url);
     url_length = strlen(url);
+
+    /*
+     * We need to find the start of the path and
+     * therefore we know the length of the scheme://hostname/
+     * part to we can force-lowercase everything up to
+     * the start of the path.
+     */
+    c = ap_strchr_c(c+3, '/');
+    if (c) {
+        char *pathstart;
+        pathstart = url_copy + (c - url);
+        *pathstart = '\0';
+        ap_str_tolower(url_copy);
+        *pathstart = '/';
+    } else {
+        ap_str_tolower(url_copy);
+    }
+    
     worker = (proxy_worker *)conf->workers->elts;
 
     /*
@@ -1233,7 +1253,7 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
     for (i = 0; i < conf->workers->nelts; i++) {
         if ( ((worker_name_length = strlen(worker->name)) <= url_length)
            && (worker_name_length > max_match)
-           && (strncasecmp(url, worker->name, worker_name_length) == 0) ) {
+           && (strncmp(url_copy, worker->name, worker_name_length) == 0) ) {
             max_worker = worker;
             max_match = worker_name_length;
         }