httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r329849 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c
Date Mon, 31 Oct 2005 16:31:33 GMT
Author: jim
Date: Mon Oct 31 08:31:29 2005
New Revision: 329849

URL: http://svn.apache.org/viewcvs?rev=329849&view=rev
Log:
Fix a problem where we are doing a case insensitive
match between the worker and the URL. Instead, only
the scheme and hostname are insensitive, the rest
should be case sensitive.

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=329849&r1=329848&r2=329849&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Oct 31 08:31:29 2005
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) 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]
+
   *) Asynchronous write completion for the Event MPM.  [Brian Pane]
 
   *) Added an End-Of-Request bucket type.  The logging of a request and

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=329849&r1=329848&r2=329849&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon Oct 31 08:31:29 2005
@@ -1216,6 +1216,7 @@
     int max_match = 0;
     int url_length;
     int worker_name_length;
+    int sh_length;
     const char *c;
     int i;
 
@@ -1224,6 +1225,18 @@
        return NULL;
 
     url_length = strlen(url);
+
+    /*
+     * We need to find the start of the path and
+     * therefore we know the length of the scheme://hostname/
+     * part.
+     */
+    c = ap_strchr_c(c+3, '/');
+    if (c)
+        sh_length = c - url;
+    else
+        sh_length = url_length;
+    
     worker = (proxy_worker *)conf->workers->elts;
 
     /*
@@ -1231,9 +1244,22 @@
      * fits best to the URL.
      */
     for (i = 0; i < conf->workers->nelts; i++) {
-        if ( ((worker_name_length = strlen(worker->name)) <= url_length)
+        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)
            && (worker_name_length > max_match)
-           && (strncasecmp(url, worker->name, worker_name_length) == 0) ) {
+           && (strncasecmp(url, worker->name, prefix) == 0)
+           && (bypass || (strncmp(url + prefix, worker->name + prefix,
+                          worker_name_length - prefix) == 0)) )
+        {
             max_worker = worker;
             max_match = worker_name_length;
         }



Mime
View raw message