You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2021/10/15 11:09:32 UTC
svn commit: r1894290 - in /httpd/httpd/trunk:
changes-entries/proxy_connect_timeout.txt modules/proxy/proxy_util.c
Author: ylavic
Date: Fri Oct 15 11:09:32 2021
New Revision: 1894290
URL: http://svn.apache.org/viewvc?rev=1894290&view=rev
Log:
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.
Added:
httpd/httpd/trunk/changes-entries/proxy_connect_timeout.txt
Modified:
httpd/httpd/trunk/modules/proxy/proxy_util.c
Added: httpd/httpd/trunk/changes-entries/proxy_connect_timeout.txt
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/changes-entries/proxy_connect_timeout.txt?rev=1894290&view=auto
==============================================================================
--- httpd/httpd/trunk/changes-entries/proxy_connect_timeout.txt (added)
+++ httpd/httpd/trunk/changes-entries/proxy_connect_timeout.txt Fri Oct 15 11:09:32 2021
@@ -0,0 +1,2 @@
+ *) mod_proxy_connect: Honor the smallest of the backend or client timeout
+ while tunneling. [Yann Ylavic]
Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1894290&r1=1894289&r2=1894290&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Fri Oct 15 11:09:32 2021
@@ -4756,6 +4756,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_tun
{
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_tun
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);