You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mt...@apache.org on 2007/07/20 10:38:00 UTC

svn commit: r557926 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/proxy/mod_proxy_balancer.c

Author: mturk
Date: Fri Jul 20 01:37:59 2007
New Revision: 557926

URL: http://svn.apache.org/viewvc?view=rev&rev=557926
Log:
Backport accepted patch from trunk.

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?view=diff&rev=557926&r1=557925&r2=557926
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Fri Jul 20 01:37:59 2007
@@ -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. 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?view=diff&rev=557926&r1=557925&r2=557926
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Fri Jul 20 01:37:59 2007
@@ -89,12 +89,6 @@
         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.

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c?view=diff&rev=557926&r1=557925&r2=557926
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c Fri Jul 20 01:37:59 2007
@@ -421,15 +421,32 @@
         *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) {