]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r481901 from trunk:
authorRuediger Pluem <rpluem@apache.org>
Mon, 3 Sep 2007 21:00:32 +0000 (21:00 +0000)
committerRuediger Pluem <rpluem@apache.org>
Mon, 3 Sep 2007 21:00:32 +0000 (21:00 +0000)
* 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

Submitted by: rpluem
Reviewed by: rpluem, jim, fielding

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

CHANGES
STATUS
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index 8116c3f6af4708063b179eb1e90f5964c17193d3..5df99b90d6f6592fd4badbdb82c89c00db311889 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,15 +1,19 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.2.6
 
+  *) 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_proxy: Improve network performance by setting APR_TCP_NODELAY
      (disable Nagle algorithm) on sockets if implemented.
      PR 42871 [Christian BOITEL <christian_boitel yahoo.fr>, Jim Jagielski]
 
   *) core: Do not replace a Date header set by a proxied backend server.
-     PR 40232. [Ruediger Pluem]
+     PR 40232 [Ruediger Pluem]
 
   *) mod_proxy: Add a missing assignment in an error checking code path.
-     PR 40865. [Andrew Rucker Jones <arjones simultan.dyndns.org>]
+     PR 40865 [Andrew Rucker Jones <arjones simultan.dyndns.org>]
 
   *) mod_proxy_connect: avoid segfault on DNS lookup failure.
      PR 40756 [Trevin Beattie <tbeattie boingo.com>]
diff --git a/STATUS b/STATUS
index 1c0b850a146f6c7bd5719de7f5500d33b8c8be9f..1528780296f6df754be1a720c0f0de60a7d41bad 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -79,15 +79,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-    * mod_proxy: 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.
-      Trunk version of patch:
-         http://svn.apache.org/viewcvs.cgi?rev=481901&view=rev
-      Backport version for 2.2.x of patch:
-         Trunk version of patch works
-      +1: rpluem, jim, fielding
-
    * mod_proxy_http: make proxy-sendchunked work as documented.
      PR 43183
       Trunk version of patch:
index 30a5e49ab987a82790c51514e31ab7abf74027a1..934f9027ab95b0d3925144ba57a5a30b9f4f383d 100644 (file)
@@ -1241,6 +1241,7 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
     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;
@@ -1266,20 +1267,25 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
         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;