]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient: keep-alive was accidentely disabled
authorWilly Tarreau <w@1wt.eu>
Fri, 19 Aug 2022 15:20:43 +0000 (17:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 2 Sep 2022 09:48:01 +0000 (11:48 +0200)
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

index 4e7f0a43adf0e3f4b82d17ed03c80edf916d7739..72acd7f438df031f425d3db1fee23c4e0dc8420f 100644 (file)
@@ -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);