httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r330085 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c
Date Tue, 01 Nov 2005 16:15:15 GMT
Author: jim
Date: Tue Nov  1 08:15:09 2005
New Revision: 330085

URL: http://svn.apache.org/viewcvs?rev=330085&view=rev
Log:
Move to a different impl which was my 1st concept and that which
Ruediger likes. Instead of adjusting pointers to areas
within the URL, simply copy it over and change it as needed.
Easier logic and not that much slower for normal cases.

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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=330085&r1=330084&r2=330085&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Nov  1 08:15:09 2005
@@ -4,7 +4,7 @@
 
   *) 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]
+     the path. [Jim Jagielski, Ruediger Pluem]
 
   *) Asynchronous write completion for the Event MPM.  [Brian Pane]
 

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=330085&r1=330084&r2=330085&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Tue Nov  1 08:15:09 2005
@@ -1216,26 +1216,33 @@
     int max_match = 0;
     int url_length;
     int worker_name_length;
-    int sh_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.
+     * part to we can force-lowercase everything up to
+     * the start of the path.
      */
     c = ap_strchr_c(c+3, '/');
-    if (c)
-        sh_length = c - url;
-    else
-        sh_length = url_length;
+    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;
 
@@ -1244,22 +1251,9 @@
      * fits best to the URL.
      */
     for (i = 0; i < conf->workers->nelts; i++) {
-        int prefix;
-        int bypass;
-        worker_name_length = strlen(worker->name);
-        if (worker_name_length <= sh_length) {
-            prefix = worker_name_length;
-            bypass = 1;
-        } else {
-            prefix = sh_length;
-            bypass = 0;
-        }
-        if ( (worker_name_length <= url_length)
+        if ( ((worker_name_length = strlen(worker->name)) <= url_length)
            && (worker_name_length > max_match)
-           && (strncasecmp(url, worker->name, prefix) == 0)
-           && (bypass || (strncmp(url + prefix, worker->name + prefix,
-                          worker_name_length - prefix) == 0)) )
-        {
+           && (strncmp(url_copy, worker->name, worker_name_length) == 0) ) {
             max_worker = worker;
             max_match = worker_name_length;
         }



Mime
View raw message