From 01e993cd59104030eeeaecf63ee1c1f497dc8bc0 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Tue, 17 Jul 2007 17:12:58 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@556972 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 6 ------ modules/proxy/proxy_util.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/STATUS b/STATUS index 5a1fe6bc929..0860d01f1bf 100644 --- 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 diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index fd0b7a84b8a..359fb074ce4 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -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, ¤t_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; } -- 2.47.3