From 88153e944f7d28f57cccc77f3228a3f54f78ce4e Mon Sep 17 00:00:00 2001 From: rofl0r Date: Mon, 7 Sep 2020 20:49:07 +0100 Subject: [PATCH] get_request_entity: respect user-set timeout get_request_entity() is only called on error, for example if a client doesn't pass a check_acl() check. in such a case it's possible that the client fd isn't yet ready to read from. using select() with a timeout timeval of {0,0} causes it to return immediately and return 0 if there's no data ready to be read. this resulted in immediate connection termination rather than returning the 403 access denied error page to the client and a confusing "no entity" message displayed in the proxy log. --- src/reqs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reqs.c b/src/reqs.c index 365b27d..87a1a82 100644 --- a/src/reqs.c +++ b/src/reqs.c @@ -1490,7 +1490,7 @@ get_request_entity(struct conn_s *connptr) FD_ZERO (&rset); FD_SET (connptr->client_fd, &rset); - tv.tv_sec = 0; + tv.tv_sec = config->idletimeout; tv.tv_usec = 0; ret = select (connptr->client_fd + 1, &rset, NULL, NULL, &tv);