]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport accepted patch from trunk.
authorMladen Turk <mturk@apache.org>
Fri, 20 Jul 2007 08:37:59 +0000 (08:37 +0000)
committerMladen Turk <mturk@apache.org>
Fri, 20 Jul 2007 08:37:59 +0000 (08:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@557926 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/proxy/mod_proxy_balancer.c

diff --git a/CHANGES b/CHANGES
index 86918701f949e8b103f2fac25b00188fb4117253..b5e6d1d5f240fe9436d28632fe0ca2516bd13cd6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.2.5
 
+  *) mod_proxy: Fix the 503 returned when session route does
+     not match any of the balancer members. [Mladen Turk]
+
   *) SECURITY: CVE-2007-1863 (cve.mitre.org)
      mod_cache: Prevent a segmentation fault if attributes are listed in a 
      Cache-Control header without any value. 
diff --git a/STATUS b/STATUS
index d926a891ee308eba00c268b5ce07e0d559bea019..1614c3dc1588efd3d03d0fc5b1ccbfa1afb8ec64 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -89,12 +89,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
         http://issues.apache.org/bugzilla/attachment.cgi?id=20480
       +1: jfclere, mturk, rpluem
 
-    * mod_proxy: Fix the 503 returned when session route does
-      not match any of the balancer members.
-      Trunk version of patch:
-        http://svn.apache.org/viewvc?view=rev&revision=556931
-      +1: mturk, rpluem, jfclere
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
 
     * ApacheMonitor: Fix Windows Vista detection.
index 5b376cbd762b0d5b314eb14166b6aa98601ef3e5..d02749b1ab32e2c0e867829fea1a4d65b814efad 100644 (file)
@@ -421,15 +421,32 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
         *worker = runtime;
     }
     else if (route && (*balancer)->sticky_force) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                     "proxy: BALANCER: (%s). All workers are in error state for route (%s)",
-                     (*balancer)->name, route);
-        if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) {
-            ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
-                         "proxy: BALANCER: (%s). Unlock failed for pre_request",
-                         (*balancer)->name);
+        int i, member_of = 0;
+        proxy_worker *workers;
+        /*
+         * We have a route provided that doesn't match the
+         * balancer name. See if the provider route is the
+         * member of the same balancer in which case return 503
+         */
+        workers = (proxy_worker *)(*balancer)->workers->elts;
+        for (i = 0; i < (*balancer)->workers->nelts; i++) {
+            if (*(workers->s->route) && strcmp(workers->s->route, route) == 0) {
+                member_of = 1;
+                break;
+            }
+            workers++;
+        }
+        if (member_of) {
+            ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+                         "proxy: BALANCER: (%s). All workers are in error state for route (%s)",
+                         (*balancer)->name, route);
+            if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
+                             "proxy: BALANCER: (%s). Unlock failed for pre_request",
+                             (*balancer)->name);
+            }
+            return HTTP_SERVICE_UNAVAILABLE;
         }
-        return HTTP_SERVICE_UNAVAILABLE;
     }
 
     if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) {