httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r481901 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c
Date Sun, 03 Dec 2006 21:24:44 GMT
Author: rpluem
Date: Sun Dec  3 13:24:43 2006
New Revision: 481901

URL: http://svn.apache.org/viewvc?view=rev&rev=481901
Log:
* Ensure that at least scheme://hostname[:port] matches between worker and URL
  when trying to find the worker that fits best to the given URL.

PR: 40910

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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?view=diff&rev=481901&r1=481900&r2=481901
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sun Dec  3 13:24:43 2006
@@ -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: Ensure that at least scheme://hostname[:port] matches between
+     worker and URL when searching for the best fitting worker for a given URL.
+     PR 40910. [Ruediger Pluem]
+
   *) mod_cache: Remove expired content from cache that cannot be revalidated.
      PR 30370. [Ruediger Pluem]
 

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?view=diff&rev=481901&r1=481900&r2=481901
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Sun Dec  3 13:24:43 2006
@@ -1324,6 +1324,7 @@
     proxy_worker *max_worker = NULL;
     int max_match = 0;
     int url_length;
+    int min_match;
     int worker_name_length;
     const char *c;
     char *url_copy;
@@ -1349,20 +1350,25 @@
         pathstart = url_copy + (c - url);
         *pathstart = '\0';
         ap_str_tolower(url_copy);
+        min_match = strlen(url_copy);
         *pathstart = '/';
     }
     else {
         ap_str_tolower(url_copy);
+        min_match = strlen(url_copy);
     }
 
     worker = (proxy_worker *)conf->workers->elts;
 
     /*
      * Do a "longest match" on the worker name to find the worker that
-     * fits best to the URL.
+     * fits best to the URL, but keep in mind that we must have at least
+     * a minimum matching of length min_match such that
+     * scheme://hostname[:port] matches between worker and url.
      */
     for (i = 0; i < conf->workers->nelts; i++) {
         if ( ((worker_name_length = strlen(worker->name)) <= url_length)
+           && (worker_name_length >= min_match)
            && (worker_name_length > max_match)
            && (strncmp(url_copy, worker->name, worker_name_length) == 0) ) {
             max_worker = worker;



Mime
View raw message