httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1227645 - in /httpd/httpd/branches/2.4.x/modules/proxy: mod_proxy.c proxy_util.c
Date Thu, 05 Jan 2012 15:47:09 GMT
Author: covener
Date: Thu Jan  5 15:47:08 2012
New Revision: 1227645

URL: http://svn.apache.org/viewvc?rev=1227645&view=rev
Log:
Merge r1227637, r1227642 from trunk:

restore the generic proxy workers to not being address-reusable.  

The guts of mod_proxy is not really ready for the addr and host on a 
proxy_conn_rec to change over time and differ from the 1 cached in the worker.

* proxy_worker->cp->addr needs to know what host/port it cached
* conn->addr and conn->hostname need to be allocated from their own subpool
  so they can be cleared as they change
* ap_proxy_determine_connection needs to be more careful about which
  addr is the TCP endpoint and what we have in either cache.
* may need to avoid updating the proxy_worker addr cache if we know
  the value is flipping.



Update the comment and checks around address/connection reusability
in mod_proxy.  

The checks and comment are a vestige of 2.0.x
mod_proxy_http where the backend proxy conn was stored in 
the frontend r->conn_config, but ap_proxy_determine_connection()
doesn't associate the frontend and backend conns like this.




Modified:
    httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c
    httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c

Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c?rev=1227645&r1=1227644&r2=1227645&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c Thu Jan  5 15:47:08 2012
@@ -2447,9 +2447,9 @@ static void child_init(apr_pool_t *p, se
                 ap_proxy_hashfunc(conf->forward->s->name, PROXY_HASHFUNC_FNV);
             /* Do not disable worker in case of errors */
             conf->forward->s->status |= PROXY_WORKER_IGNORE_ERRORS;
+            ap_proxy_initialize_worker(conf->forward, s, conf->pool);
             /* Disable address cache for generic forward worker */
             conf->forward->s->is_address_reusable = 0;
-            ap_proxy_initialize_worker(conf->forward, s, conf->pool);
         }
         if (!reverse) {
             ap_proxy_define_worker(p, &reverse, NULL, NULL, "http://www.apache.org",
0);
@@ -2462,11 +2462,11 @@ static void child_init(apr_pool_t *p, se
                 ap_proxy_hashfunc(reverse->s->name, PROXY_HASHFUNC_FNV);
             /* Do not disable worker in case of errors */
             reverse->s->status |= PROXY_WORKER_IGNORE_ERRORS;
+            conf->reverse = reverse;
+            ap_proxy_initialize_worker(conf->reverse, s, conf->pool);
             /* Disable address cache for generic reverse worker */
             reverse->s->is_address_reusable = 0;
         }
-        conf->reverse = reverse;
-        ap_proxy_initialize_worker(conf->reverse, s, conf->pool);
         s = s->next;
     }
 }

Modified: httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c?rev=1227645&r1=1227644&r2=1227645&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c Thu Jan  5 15:47:08 2012
@@ -2020,19 +2020,17 @@ ap_proxy_determine_connection(apr_pool_t
                            uri->fragment ? uri->fragment : "", NULL);
     }
     /*
-     * 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.
+     * Figure out if our passed in proxy_conn_rec has a usable
+     * address cached.
      *
-     * TODO: Handle this much better...
+     * TODO: Handle this much better... 
+     *
+     * XXX: If generic workers are ever address-reusable, we need 
+     *      to check host and port on the conn and be careful about
+     *      spilling the cached addr from the worker.
      */
     if (!conn->hostname || !worker->s->is_address_reusable ||
-         worker->s->disablereuse ||
-         (r->connection->keepalives &&
-         (r->proxyreq == PROXYREQ_PROXY || r->proxyreq == PROXYREQ_REVERSE) &&
-         (strcasecmp(conn->hostname, uri->hostname) != 0) ) ) {
+        worker->s->disablereuse) {
         if (proxyname) {
             conn->hostname = apr_pstrdup(conn->pool, proxyname);
             conn->port = proxyport;



Mime
View raw message