]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* mod_proxy: Add in 'disablereuse' option for parity with similar
authorJim Jagielski <jim@apache.org>
Tue, 13 May 2008 20:32:39 +0000 (20:32 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 13 May 2008 20:32:39 +0000 (20:32 +0000)
   mod_jk functionality.
      http://svn.apache.org/viewvc?view=rev&revision=627728

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@655998 13f79535-47bb-0310-9956-ffa450edef68

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

diff --git a/CHANGES b/CHANGES
index bc38a6cd502162bcf64e6cba5000e427d218d6ca..dc16438a190e6a1f4083fb32371bf74da0e2acb1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -36,6 +36,10 @@ Changes with Apache 2.2.9
      or remote port can be logged.  PR 43415.  [Adam Hasselbalch Hansen
      <ahh@one.com>, Ruediger Pluem, Jeff Trawick]
 
+  *) Added 'disablereuse' option for ProxyPass which, essentially,
+     disables connection pooling for the backend servers.
+     [Jim Jagielski]
+
   *) mod_speling: remove regression from 1.3/2.0 behavior and
      drop dependency between mod_speling and AcceptPathInfo.
      PR 43562 [Jose Kahan <jose w3.org>]
diff --git a/STATUS b/STATUS
index bd35d33ddb270c986874db39324f8ac7b0148e9f..e2c310e8caec34b63a6070b5876277d94392e50c 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -98,16 +98,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
        Trunk version works
   +1: fielding, rpluem, niq
 
- * mod_proxy: Add in 'disablereuse' option for parity with similar
-   mod_jk functionality.
-   Trunk version of patch:
-       http://svn.apache.org/viewvc?view=rev&revision=627728
-   Backport version for 2.2.x of patch:
-       http://people.apache.org/~jim/patches/proxy-disablereuse-v2.txt
-   +1: jim, rpluem
-   niq: +1 with the proviso that there's still a typo in the docs in
-        proxy-disablereuse-v2.txt.  But it's fixed in r655986.
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
 
index dc544779a4ccc862484a7b9ceab6cb7677efdfdf..39f40fd69fee09998b4e6b8cf77a4df6a085b646 100644 (file)
@@ -663,6 +663,17 @@ 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 persistent connection and pool for that backend.
+    This helps in various situations where a firewall between Apache and
+    the backend server (regardless of protocol) tends to silently
+    drop connections or when backends themselves may be under round-
+    robin DNS. 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 7c9a3b05a7d9a0bdd084427b711efbfe746cd2cb..058a4506bbddc5d5e90b66bb4f3c1eecc9c13ed9 100644 (file)
  * 20051115.9 (2.2.7)  Add ap_send_interim_response API
  * 20051115.10(2.2.7)  Added ap_mod_status_reqtail (minor)
  * 20051115.11(2.2.7)  Add *ftp_directory_charset to proxy_dir_conf
- * 20051115.12(2.2.8) Add optional function ap_logio_add_bytes_in() to mog_logio
+ * 20051115.12(2.2.8)  Add optional function ap_logio_add_bytes_in() to mog_logio
+ * 20051115.13(2.2.9)  Add disablereuse and disablereuse_set
+ *                     to proxy_worker struct (minor)
  *
  */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 12                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 13                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index de48638bc3dc4b86b96e3204388efbdf97c6b49c..06c8b3384de970faa782cfe00d8b5e8efbf0f9b8 100644 (file)
@@ -168,6 +168,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 3944104ebf0e62beb6a0392d9a1b583d6d42441f..8628d65a997db7ff8ac46e0e415a9f977e0a1d96 100644 (file)
@@ -337,6 +337,8 @@ struct proxy_worker {
     apr_interval_time_t ping_timeout;
     char ping_timeout_set;
     char            retry_set;
+    char            disablereuse;
+    char            disablereuse_set;
 };
 
 /*
index fb2c40a09c6d3d452d21f80cb8a9daa7d53bd2a3..d3c227e78374ed236ddfd431694bbfb37d5bd415 100644 (file)
@@ -1617,7 +1617,8 @@ static apr_status_t connection_cleanup(void *theconn)
 #endif
 
     /* determine if the connection need to be closed */
-    if (conn->close_on_recycle || conn->close) {
+    if (conn->close_on_recycle || conn->close || worker->disablereuse ||
+        !worker->is_address_reusable) {
         apr_pool_t *p = conn->pool;
         apr_pool_clear(conn->pool);
         memset(conn, 0, sizeof(proxy_conn_rec));
@@ -1771,8 +1772,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);
@@ -1984,7 +1990,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) ) ) {