From f80713ba8eb4f5397134155330b9c6eb064eb7f7 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 19 Aug 2022 17:20:43 +0200 Subject: [PATCH] BUG/MINOR: httpclient: keep-alive was accidentely disabled The servers were not set with default settings, meaning that a few settings including the pool_max_delay were not set, thus disabling connection pools, which is the cause of the fact that keep-alive was disabled as reported in issue #1831. There might possibly be other issues pending since all these fields were left to zero. Note that this patch alone will not fix keep-alive because the applet does not enforce SE_FL_NOT_FIRST and relies on the default http-reuse safe, thus if servers are not shared, all requests are considered first ones and do not reuse existing connections. In 2.7, commit ecb40b2c3 ("MINOR: backend: always satisfy the first req reuse rule with l7 retries") addressed this in a more elegant way by fixing http-reuse to take into account the fact that properly configured l7 retries provide exactly the capability that reuse safe was trying to cover, and this patch is suitable for backporting. This patch should be backported to 2.6 only. --- src/http_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/http_client.c b/src/http_client.c index 4e7f0a43a..72acd7f43 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -1153,6 +1153,7 @@ static int httpclient_precheck() goto err; } + srv_settings_cpy(httpclient_srv_raw, &httpclient_proxy->defsrv, 0); httpclient_srv_raw->iweight = 0; httpclient_srv_raw->uweight = 0; httpclient_srv_raw->xprt = xprt_get(XPRT_RAW); @@ -1172,6 +1173,7 @@ static int httpclient_precheck() err_code |= ERR_ALERT | ERR_FATAL; goto err; } + srv_settings_cpy(httpclient_srv_ssl, &httpclient_proxy->defsrv, 0); httpclient_srv_ssl->iweight = 0; httpclient_srv_ssl->uweight = 0; httpclient_srv_ssl->xprt = xprt_get(XPRT_SSL);