Index | Thread | Search

From:
giovanni@paclan.it
Subject:
Re: httpd: apply correct request timeouts for server
To:
mischief@offblast.org, tech@openbsd.org
Cc:
florian@openbsd.org
Date:
Mon, 23 Dec 2024 08:21:47 +0100

Download raw body.

Thread
On 12/20/24 3:49 PM, 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.
make sense and reads good.
ok giovanni@
  Cheers
   Giovanni

> ---
>   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;
>