]> granicus.if.org Git - apache/commitdiff
Add in mod_jk's disablereuse analog for mod_proxy.
authorJim Jagielski <jim@apache.org>
Thu, 14 Feb 2008 12:55:57 +0000 (12:55 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 14 Feb 2008 12:55:57 +0000 (12:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@627728 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_proxy.xml
modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index 30a484b6f609bf2d361d4e4b009c25e2c0051a49..598479ce57103b93632b3af6a16cb331ac5e54cb 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) Added 'disablereuse' option for ProxyPass which, essentially,
+     disables connection pooling for the backend servers.
+     [Jim Jagielski]
+
   *) Activate mod_cache, mod_file_cache and mod_disc_cache as part of the
      'most' set for '--enable-modules' and '--enable-shared-mods'. Include 
      mod_mem_cache in 'all' as well. [Dirk-Willem van Gulik]
index c9e933b7ebf7a9dc057e1d931fa98ff7ee5aa910..f25640d73639fd25c5117a1588627f0cccff1d42 100644 (file)
@@ -693,6 +693,16 @@ expressions</description>
     in the pool the Apache will return <code>SERVER_BUSY</code> status to
     the client.
     </td></tr>
+    <tr><td>disablereuse</td>
+        <td>Off</td>
+        <td>This parameter should be used when you want to force mod_proxy
+    to immediately close a connection to the backend after being used, and
+    thus, disable its persistant connection and pool for that backend.
+    This helps in various situations where a firewall between Apache and
+    the backend server (irregardless of protocol) tends to silently
+    drop connections. To prevent mod_proxy from reusing the backend connection,
+    set this property value to <code>On</code>. 
+    </td></tr>
     <tr><td>flushpackets</td>
         <td>off</td>
         <td>Determines whether the proxy module will auto-flush the output
index 4afb9ca8aa1f1254ee5ccb35537d13884010d1a2..8ed42df24cd9fab4d9dad7b1603ea6f635e5ba2e 100644 (file)
@@ -176,6 +176,15 @@ static const char *set_worker_param(apr_pool_t *p,
             return "KeepAlive must be On|Off";
         worker->keepalive_set = 1;
     }
+    else if (!strcasecmp(key, "disablereuse")) {
+        if (!strcasecmp(val, "on"))
+            worker->disablereuse = 1;
+        else if (!strcasecmp(val, "off"))
+            worker->disablereuse = 0;
+        else
+            return "DisableReuse must be On|Off";
+        worker->disablereuse_set = 1;
+    }
     else if (!strcasecmp(key, "route")) {
         /* Worker route.
          */
index 34eafab44bef1d3a49d44d3bb3c8e910b573e997..f13456415f15409c5254ba35b83f9ec24283ae86 100644 (file)
@@ -352,6 +352,8 @@ struct proxy_worker {
     char ping_timeout_set;
     int             lbset;      /* load balancer cluster set */
     char            retry_set;
+    char            disablereuse;
+    char            disablereuse_set;
 };
 
 /*
index 448e32798955d803cc14d89a5db27bb3aa880649..0a27b18c2720c9a8a1577b2d9b72916c6695d245 100644 (file)
@@ -1698,7 +1698,7 @@ static apr_status_t connection_cleanup(void *theconn)
     }
 
     /* determine if the connection need to be closed */
-    if (conn->close || !worker->is_address_reusable) {
+    if (conn->close || !worker->is_address_reusable || worker->disablereuse) {
         apr_pool_t *p = conn->pool;
         apr_pool_clear(p);
         conn = apr_pcalloc(p, sizeof(proxy_conn_rec));
@@ -1902,8 +1902,13 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
     if (!worker->retry_set) {
         worker->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
     }
-    /* By default address is reusable */
-    worker->is_address_reusable = 1;
+    /* By default address is reusable unless DisableReuse is set */
+    if (worker->disablereuse) {
+        worker->is_address_reusable = 0;
+    }
+    else {
+        worker->is_address_reusable = 1;
+    }
 
 #if APR_HAS_THREADS
     ap_mpm_query(AP_MPMQ_MAX_THREADS, &mpm_threads);
@@ -2114,7 +2119,8 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
      *
      * TODO: Handle this much better...
      */
-    if (!conn->hostname || !worker->is_address_reusable ||
+    if (!conn->hostname || !worker->is_address_reusable || 
+         worker->disablereuse ||
          (r->connection->keepalives &&
          (r->proxyreq == PROXYREQ_PROXY || r->proxyreq == PROXYREQ_REVERSE) &&
          (strcasecmp(conn->hostname, uri->hostname) != 0) ) ) {