You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2005/11/29 16:05:19 UTC

svn commit: r349723 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

Author: jim
Date: Tue Nov 29 07:05:16 2005
New Revision: 349723

URL: http://svn.apache.org/viewcvs?rev=349723&view=rev
Log:
Fix case where a shared keepalive connection results in
different workers from being accessed. Try to be wise and
fast about the tests before we do the expensive string
comparison.

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

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=349723&r1=349722&r2=349723&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Tue Nov 29 07:05:16 2005
@@ -1824,12 +1824,22 @@
                            uri->fragment ? "#" : "",
                            uri->fragment ? uri->fragment : "", NULL);
     }
-    if (!worker->is_address_reusable) {
+    /*
+     * 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.
+     *
+     * TODO: Handle this much better...
+     */
+    if (!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 = proxyname;
+            conn->hostname = apr_pstrdup(conn->pool, proxyname);
             conn->port = proxyport;
         } else {
-            conn->hostname = uri->hostname;
+            conn->hostname = apr_pstrdup(conn->pool, uri->hostname);
             conn->port = uri->port;
         }
     }