You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2006/01/13 14:23:21 UTC

svn commit: r368708 - in /httpd/httpd/branches/2.2.x: STATUS modules/proxy/proxy_util.c

Author: niq
Date: Fri Jan 13 05:23:17 2006
New Revision: 368708

URL: http://svn.apache.org/viewcvs?rev=368708&view=rev
Log:
Backport proxy_util fix to select worker (jim)
http://svn.apache.org/viewcvs.cgi/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=356030&view=diff&r1=356030&r2=332306

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

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/STATUS?rev=368708&r1=368707&r2=368708&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Fri Jan 13 05:23:17 2006
@@ -99,11 +99,6 @@
       Message-ID: <43...@web.turner.com>
       +1: jerenkrantz, jim, wrowe
 
-    * proxy_util: Fix case where a shared keepalive connection results in
-      different (and incorrect) workers from being accessed.
-      http://svn.apache.org/viewcvs.cgi/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=356030&view=diff&r1=356030&r2=332306
-      +1: jim, rpluem, mturk
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
 

Modified: httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c?rev=368708&r1=368707&r2=368708&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c Fri Jan 13 05:23:17 2006
@@ -1824,16 +1824,19 @@
                            uri->fragment ? "#" : "",
                            uri->fragment ? uri->fragment : "", NULL);
     }
-    if (!worker->is_address_reusable) {
-        if (proxyname) {
-            conn->hostname = proxyname;
-            conn->port = proxyport;
-        } else {
-            conn->hostname = uri->hostname;
-            conn->port = uri->port;
-        }
-    }
-    else if (!conn->hostname) {
+    /*
+     * Make sure that we pick the the correct and valid worker.
+     * If a single keepalive connection triggers different workers,
+     * then we have a problem (we don't select the correct one).
+     * Do an expensive check in this case, where we compare the
+     * the hostnames associated between the two.
+     *
+     * TODO: Handle this much better...
+     */
+    if (!conn->hostname || !worker->is_address_reusable ||   
+         (r->connection->keepalives &&
+         (r->proxyreq == PROXYREQ_PROXY || r->proxyreq == PROXYREQ_REVERSE) &&
+         (strcasecmp(conn->hostname, uri->hostname) != 0) ) ) {
         if (proxyname) {
             conn->hostname = apr_pstrdup(conn->pool, proxyname);
             conn->port = proxyport;