From: mischief@offblast.org Subject: Re: httpd: apply correct request timeouts for server To: tech@openbsd.org Cc: florian@openbsd.org Date: Fri, 20 Dec 2024 06:49:21 -0800 ok, updated. From 91f00b5dc1a50ec116f9cf2b045a93b711f0835d Mon Sep 17 00:00:00 2001 From: Nick Owens 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