summaryrefslogtreecommitdiffstats
path: root/modules/proxy
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2021-10-15 13:09:32 +0200
committerYann Ylavic <ylavic@apache.org>2021-10-15 13:09:32 +0200
commitdcbf44fb14497add211020ef3629f1f12daac6e1 (patch)
tree75c89230b47b52fa45b6102a0da10bda7302af18 /modules/proxy
parentFollow up to r1894285: add idle_threads and max_workers to trace5. (diff)
downloadapache2-dcbf44fb14497add211020ef3629f1f12daac6e1.tar.xz
apache2-dcbf44fb14497add211020ef3629f1f12daac6e1.zip
mod_proxy_connect: Honor the smallest of the backend or client timeout.
It seems that mod_proxy_connect has never applied any timeout in its tunneling loop. Address this by setting a default timeout in ap_proxy_tunnel_create() since mod_proxy_connect does not overwrite tunnel->timeout (while proxy_http and proxy_wstunnel do). This default timeout is set to the smallest of the backend side or the client side timeout. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894290 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/proxy')
-rw-r--r--modules/proxy/proxy_util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
index e620ee88ed..00492d7739 100644
--- a/modules/proxy/proxy_util.c
+++ b/modules/proxy/proxy_util.c
@@ -4756,6 +4756,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_tunnel_create(proxy_tunnel_rec **ptunnel,
{
apr_status_t rv;
conn_rec *c_i = r->connection;
+ apr_interval_time_t timeout = -1;
proxy_tunnel_rec *tunnel;
*ptunnel = NULL;
@@ -4795,6 +4796,13 @@ PROXY_DECLARE(apr_status_t) ap_proxy_tunnel_create(proxy_tunnel_rec **ptunnel,
tunnel->origin->pfd->desc.s = ap_get_conn_socket(c_o);
tunnel->origin->pfd->client_data = tunnel->origin;
+ /* Defaults to the smallest timeout of both connections */
+ apr_socket_timeout_get(tunnel->client->pfd->desc.s, &timeout);
+ apr_socket_timeout_get(tunnel->origin->pfd->desc.s, &tunnel->timeout);
+ if (timeout >= 0 && (tunnel->timeout < 0 || tunnel->timeout > timeout)) {
+ tunnel->timeout = timeout;
+ }
+
/* We should be nonblocking from now on the sockets */
apr_socket_opt_set(tunnel->client->pfd->desc.s, APR_SO_NONBLOCK, 1);
apr_socket_opt_set(tunnel->origin->pfd->desc.s, APR_SO_NONBLOCK, 1);