Author: jim
Date: Tue May 13 13:32:39 2008
New Revision: 655998
URL: http://svn.apache.org/viewvc?rev=655998&view=rev
Log:
* mod_proxy: Add in 'disablereuse' option for parity with similar
mod_jk functionality.
http://svn.apache.org/viewvc?view=rev&revision=627728
Modified:
httpd/httpd/branches/2.2.x/CHANGES
httpd/httpd/branches/2.2.x/STATUS
httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml
httpd/httpd/branches/2.2.x/include/ap_mmn.h
httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c
httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h
httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c
Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=655998&r1=655997&r2=655998&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Tue May 13 13:32:39 2008
@@ -36,6 +36,10 @@
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>]
Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=655998&r1=655997&r2=655998&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Tue May 13 13:32:39 2008
@@ -98,16 +98,6 @@
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 ]
Modified: httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml?rev=655998&r1=655997&r2=655998&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml Tue May 13 13:32:39 2008
@@ -663,6 +663,17 @@
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
Modified: httpd/httpd/branches/2.2.x/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/ap_mmn.h?rev=655998&r1=655997&r2=655998&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.2.x/include/ap_mmn.h Tue May 13 13:32:39 2008
@@ -120,7 +120,9 @@
* 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)
*
*/
@@ -129,7 +131,7 @@
#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
Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c?rev=655998&r1=655997&r2=655998&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c Tue May 13 13:32:39 2008
@@ -168,6 +168,15 @@
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.
*/
Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h?rev=655998&r1=655997&r2=655998&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h Tue May 13 13:32:39 2008
@@ -337,6 +337,8 @@
apr_interval_time_t ping_timeout;
char ping_timeout_set;
char retry_set;
+ char disablereuse;
+ char disablereuse_set;
};
/*
Modified: httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c?rev=655998&r1=655997&r2=655998&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 Tue May 13 13:32:39 2008
@@ -1617,7 +1617,8 @@
#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 @@
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 @@
*
* 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) ) ) {
|