Index | Thread | Search

From:
Florian Obser <florian@openbsd.org>
Subject:
Re: httpd: apply correct request timeouts for server
To:
tech@openbsd.org
Date:
Sun, 22 Dec 2024 14:06:13 +0100

Download raw body.

Thread
I would also take an OK from another developer in case everyone is too
afraid to accidentally become the new httpd maintainer...

On 2024-12-20 06:49 -08, mischief@offblast.org wrote:
> ok, updated.
>
> From 91f00b5dc1a50ec116f9cf2b045a93b711f0835d Mon Sep 17 00:00:00 2001
> From: Nick Owens <mischief@offblast.org>
> Date: Tue, 17 Dec 2024 09:06:59 -0800
> Subject: [PATCH] httpd: apply correct request timeouts for server
>
> httpd applies a request timeout shortly after accepting a connection,
> and this timeout will come from the configuration of the first listener.
>
> the configured timeout for a server should be reapplied after we match
> the incoming request to a server configuration, otherwise we continue to
> use the default from the first listener instead of the timeout asked
> for.
> ---
>  usr.sbin/httpd/server_http.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c
> index 0a814e7a656..3ab3b64392a 100644
> --- a/usr.sbin/httpd/server_http.c
> +++ b/usr.sbin/httpd/server_http.c
> @@ -1368,6 +1368,10 @@ server_response(struct httpd *httpd, struct client *clt)
>  		srv_conf = clt->clt_srv_conf;
>  	}
>  
> +	/* Set request timeout from matching host configuration */
> +	bufferevent_settimeout(clt->clt_bev,
> +	    srv_conf->requesttimeout.tv_sec, srv_conf->requesttimeout.tv_sec);
> +
>  	if (clt->clt_persist >= srv_conf->maxrequests)
>  		clt->clt_persist = 0;
>  
> -- 
>
> 2.45.2
>

-- 
In my defence, I have been left unsupervised.