> Am 30.06.2023 um 15:56 schrieb Yann Ylavic <ylavic....@gmail.com>:
> 
> On Fri, Jun 30, 2023 at 2:44 PM Ruediger Pluem <rpl...@apache.org> wrote:
>> 
>> On 6/30/23 11:08 AM, ic...@apache.org wrote:
>>> Author: icing
>>> Date: Fri Jun 30 09:08:23 2023
>>> New Revision: 1910704
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1910704&view=rev
>>> Log:
>>> proxy: in proxy tunnels, use the smaller timeout value of
>>>       client and origin as timeout for polling the tunnel.
>>> 
>>> 
>>> Modified:
>>>    httpd/httpd/trunk/modules/proxy/proxy_util.c
>>> 
>>> Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
>>> URL: 
>>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1910704&r1=1910703&r2=1910704&view=diff
>>> ==============================================================================
>>> --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
>>> +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Fri Jun 30 09:08:23 2023
>>> @@ -4921,9 +4921,9 @@ PROXY_DECLARE(apr_status_t) ap_proxy_tun
>>>     apr_socket_timeout_get(tunnel->origin->pfd->desc.s, &origin_timeout);
>>>     apr_socket_opt_set(tunnel->origin->pfd->desc.s, APR_SO_NONBLOCK, 1);
>>> 
>>> -    /* Defaults to the biggest timeout of both connections */
>>> -    tunnel->timeout = (origin_timeout >= 0 && origin_timeout > 
>>> client_timeout)?
>>> -                      origin_timeout : client_timeout;
>>> +    /* Defaults to the smallest timeout of both connections */
>>> +    tunnel->timeout = (client_timeout >= 0 && client_timeout < 
>>> origin_timeout ?
>>> +                       client_timeout : origin_timeout);
>> 
>> Why?
> 
> We discussed this (quickly) with Stefan on
> https://github.com/apache/httpd/pull/366, but hey the commit is here
> for review finally :)
> 
>> It was the other way round on purpose, e.g. if Timeout is set to 5 for a 
>> small front end timeout and ProxyTimeout is set to
>> e.g. 600 to keep Websockets open for 10 minutes.
> 
> It seems to me that using Timeout (5s) here is a valid case too if
> Timeout < ProxyTimeout (as in your example) is a way to limit how long
> a client can consume httpd resources.
> So maybe we should only use the backend timeout which is an easy(er)
> way for the user to control this?

So, the goal is to allow someone keeping the websocket open for longer
than we usually allow for HTTP requests, to set a long ProxyTimeout or
timeout parameter to ProxyPass.

For HTTP/1.1 that would override the connection Timeout, since the tunnel
poll would only use the largest value.

For HTTP/2 I have to check how that how to accomplish that. The working
there is different.

Reply via email to