]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* mod_proxy: Add the possibility to set a separate connection timeout for
authorJim Jagielski <jim@apache.org>
Wed, 17 Sep 2008 14:23:35 +0000 (14:23 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 17 Sep 2008 14:23:35 +0000 (14:23 +0000)
    backend workers.
       PR: 45445
           Trunk version of patch:
                  http://svn.apache.org/viewvc?rev=684341&view=rev
                      Backport version for 2.2.x of patch:
                             Trunk version of patch works, but
                                    http://people.apache.org/~rpluem/patches/37770_2.2.x.diff
                                           fixes a conflict regarding the needed minor bump.
                                               +1: rpluem, jim, jerenkrantz

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

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

diff --git a/CHANGES b/CHANGES
index d5883a952baaff37b9d5f4433443b451f258e72a..b5d3d0d5c33f1e8f61ff403689e80b24fae59e7c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -18,6 +18,10 @@ Changes with Apache 2.2.10
   *) mod_ssl: Rewrite shmcb to avoid memory alignment issues.  PR 42101.
      [Geoff Thorpe]
 
+  *) mod_proxy_http: Introduce environment variable proxy-initial-not-pooled to
+     avoid reusing pooled connections if the client connection is an initial
+     connection. PR 37770. [Ruediger Pluem]
+
   *) mod_dav_fs: Retrieve minimal system information about directory
      entries when walking a DAV fs, resolving a performance degradation on
      Windows.  PR 45464.  [Joe Orton, Jeff Trawick]
index 8bfc3187b076fe2d7caaaa4990470b8c3ccb5045..bebe75e275bc0a0adb059a4b96dd22ffda4088df 100644 (file)
@@ -689,6 +689,12 @@ expressions</description>
     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
index 2c226b6cc62581a5e16d694385e1dddf169efff4..656189df53d7027037fe1937522298c62de73e26 100644 (file)
  *                     structure
  * 20051115.15(2.2.9)  Add interpolate_env to proxy_dir_conf and
  *                     introduce proxy_req_conf.
+ * 20051115.16(2.2.9)  Add conn_timeout and conn_timeout_set to
+ *                     proxy_worker struct.
  *
  */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 15                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 16                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index 00bcfebafe65d48fa76290121afe161e1d68bb93..a6c50242c45c2675579817536ea86f4004cf433c 100644 (file)
@@ -275,6 +275,16 @@ static const char *set_worker_param(apr_pool_t *p,
         worker->ping_timeout = apr_time_from_sec(ival);
         worker->ping_timeout_set = 1;
     }
+    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";
     }
index fdb48bf33fc39dce41cde51b6aecf35fc267c312..2381515c5ddf99875221b228c3749f5702098555 100644 (file)
@@ -355,6 +355,8 @@ struct proxy_worker {
     char            retry_set;
     char            disablereuse;
     char            disablereuse_set;
+    apr_interval_time_t conn_timeout;
+    char            conn_timeout_set;
 };
 
 /*
index abc056cd5359fdf89c842864b7ae3dd3d1ef6641..028bd1abc7973680377bd83a280f1f696ddd5689 100644 (file)
@@ -2329,8 +2329,11 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
                           "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) {
@@ -2368,6 +2371,17 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
             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;
     }