]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r546128, r550514 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 17 Jul 2007 17:12:58 +0000 (17:12 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 17 Jul 2007 17:12:58 +0000 (17:12 +0000)
Arrange the proxy timeout behaviour.

Fix the timeout logic. The order is now:
1 - worker->timeout
2 - proxy_conf->timeout
3 - server->timeout.
ap_get_module_config() is not perfect by that is easy to port back to 2.2.x.

Submitted by: jfclere
Reviewed by: jim

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

STATUS
modules/proxy/proxy_util.c

diff --git a/STATUS b/STATUS
index 5a1fe6bc929a47556670b0c110c05f7d1f27c2f2..0860d01f1bf1b9cfea5220110fe859b7e709f42f 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -85,12 +85,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
       http://svn.apache.org/viewvc?view=rev&revision=541990
       +1: niq, rpluem, jim
 
-    * mod_proxy: Arrange the timeout handling. Related to PR11540.
-      Trunk version of patch:
-        http://svn.apache.org/viewvc?view=rev&revision=550514
-        http://svn.apache.org/viewvc?view=rev&revision=546128
-      +1: jfclere, jim, rpluem
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
     
     * mod_proxy: Fix the 503 returned when session route does
index fd0b7a84b8a9cec5cc73800a3e4c159497ff8ce8..359fb074ce4274c03a5eaf8cfdae7fdcd6034317 100644 (file)
@@ -2036,6 +2036,9 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
     int loglevel;
     apr_sockaddr_t *backend_addr = conn->addr;
     apr_socket_t *newsock;
+    void *sconf = s->module_config;
+    proxy_server_conf *conf =
+        (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module);
 
     if (conn->sock) {
         /*
@@ -2084,6 +2087,9 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
         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);
         }
@@ -2147,6 +2153,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
 {
     apr_sockaddr_t *backend_addr = conn->addr;
     int rc;
+    apr_interval_time_t current_timeout;
 
     /*
      * The socket is now open, create a new backend server connection
@@ -2196,6 +2203,12 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
                  "proxy: %s: connection complete to %pI (%s)",
                  proxy_function, backend_addr, conn->hostname);
 
+    /*
+     * save the timout of the socket because core_pre_connection
+     * will set it to base_server->timeout
+     * (core TimeOut directive).
+     */
+    apr_socket_timeout_get(conn->sock, &current_timeout);
     /* set up the connection filters */
     rc = ap_run_pre_connection(conn->connection, conn->sock);
     if (rc != OK && rc != DONE) {
@@ -2205,6 +2218,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
                      proxy_function, rc);
         return rc;
     }
+    apr_socket_timeout_set(conn->sock, current_timeout);
 
     return OK;
 }