You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2008/08/09 22:52:46 UTC
svn commit: r684341 - in /httpd/httpd/trunk: CHANGES
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
Author: rpluem
Date: Sat Aug 9 13:52:46 2008
New Revision: 684341
URL: http://svn.apache.org/viewvc?rev=684341&view=rev
Log:
* Add the possibility to set a separate connection timeout for backend
workers.
PR: 45445
Submitted by: rahul <rahul sun.com>
Reviewed by: rpluem
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
httpd/httpd/trunk/include/ap_mmn.h
httpd/httpd/trunk/modules/proxy/mod_proxy.c
httpd/httpd/trunk/modules/proxy/mod_proxy.h
httpd/httpd/trunk/modules/proxy/proxy_util.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=684341&r1=684340&r2=684341&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Aug 9 13:52:46 2008
@@ -2,6 +2,10 @@
Changes with Apache 2.3.0
[ When backported to 2.2.x, remove entry from this file ]
+ *) mod_proxy: Add connectiontimeout parameter for proxy workers in order to
+ be able to set the timeout for connecting to the backend separately.
+ PR 45445. [Ruediger Pluem, rahul <rahul sun.com>]
+
*) mod_dav_fs: Retrieve minimal system information about directory
entries when walking a DAV fs, resolving a performance degradation on
Windows. PR 45464. [Jeff Trawick]
Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml?rev=684341&r1=684340&r2=684341&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml Sat Aug 9 13:52:46 2008
@@ -697,6 +697,12 @@
connections in the pool the Apache will return <code>SERVER_BUSY</code>
status to the client.
</td></tr>
+ <tr><td>connectiontimeout</td>
+ <td>timeout</td>
+ <td>Connect timeout in seconds.
+ The number of seconds Apache waits for the creation of a connection to
+ the backend to complete.
+ </td></tr>
<tr><td>disablereuse</td>
<td>Off</td>
<td>This parameter should be used when you want to force mod_proxy
Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=684341&r1=684340&r2=684341&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Sat Aug 9 13:52:46 2008
@@ -163,6 +163,9 @@
* Rationale: see r661069.
* 20080528.1 (2.3.0-dev) add has_realm_hash() to authn_provider struct
* 20080722.0 (2.3.0-dev) remove has_realm_hash() from authn_provider struct
+ * 20080722.1 (2.3.0-dev) Add conn_timeout and conn_timeout_set to
+ * proxy_worker struct.
+ *
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -170,7 +173,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20080722
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=684341&r1=684340&r2=684341&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Sat Aug 9 13:52:46 2008
@@ -281,6 +281,16 @@
return "lbset must be between 0 and 99";
worker->lbset = ival;
}
+ else if (!strcasecmp(key, "connectiontimeout")) {
+ /* Request timeout in seconds.
+ * Defaults to connection timeout
+ */
+ ival = atoi(val);
+ if (ival < 1)
+ return "Connectiontimeout must be at least one second.";
+ worker->conn_timeout = apr_time_from_sec(ival);
+ worker->conn_timeout_set = 1;
+ }
else {
return "unknown Worker parameter";
}
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=684341&r1=684340&r2=684341&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Sat Aug 9 13:52:46 2008
@@ -352,6 +352,8 @@
char retry_set;
char disablereuse;
char disablereuse_set;
+ apr_interval_time_t conn_timeout;
+ char conn_timeout_set;
};
/*
Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=684341&r1=684340&r2=684341&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Sat Aug 9 13:52:46 2008
@@ -2325,8 +2325,11 @@
"Failed to set");
}
- /* Set a timeout on the socket */
- if (worker->timeout_set == 1) {
+ /* Set a timeout for connecting to the backend on the socket */
+ if (worker->conn_timeout_set) {
+ apr_socket_timeout_set(newsock, worker->conn_timeout);
+ }
+ else if (worker->timeout_set == 1) {
apr_socket_timeout_set(newsock, worker->timeout);
}
else if (conf->timeout_set == 1) {
@@ -2364,6 +2367,17 @@
continue;
}
+ /* Set a timeout on the socket */
+ if (worker->timeout_set == 1) {
+ apr_socket_timeout_set(newsock, worker->timeout);
+ }
+ else if (conf->timeout_set == 1) {
+ apr_socket_timeout_set(newsock, conf->timeout);
+ }
+ else {
+ apr_socket_timeout_set(newsock, s->timeout);
+ }
+
conn->sock = newsock;
connected = 1;
}