You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2007/07/17 19:13:03 UTC

svn commit: r556972 - in /httpd/httpd/branches/2.2.x: STATUS modules/proxy/proxy_util.c

Author: jim
Date: Tue Jul 17 10:12:58 2007
New Revision: 556972

URL: http://svn.apache.org/viewvc?view=rev&rev=556972
Log:
Merge r546128, r550514 from trunk:

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

Modified:
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?view=diff&rev=556972&r1=556971&r2=556972
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Tue Jul 17 10:12:58 2007
@@ -85,12 +85,6 @@
       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

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?view=diff&rev=556972&r1=556971&r2=556972
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c Tue Jul 17 10:12:58 2007
@@ -2036,6 +2036,9 @@
     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 @@
         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 @@
 {
     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: %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_function, rc);
         return rc;
     }
+    apr_socket_timeout_set(conn->sock, current_timeout);
 
     return OK;
 }