]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: contrib/prometheus-exporter: avoid connection close header
authorWilliam Dauchy <wdauchy@gmail.com>
Mon, 11 Jan 2021 19:07:48 +0000 (20:07 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Jan 2021 14:11:38 +0000 (15:11 +0100)
it does not seem to have a reason to close connections after each
request; reflect that in tests by doing all requests within the same
client.

Signed-off-by: William Dauchy <wdauchy@gmail.com>
contrib/prometheus-exporter/service-prometheus.c
reg-tests/contrib/prometheus.vtc

index beca87959de7d209c3d6457fd2af8cda7a21c3b3..63ccdd155d0c85e8b76b64db244b79d05bffd858 100644 (file)
@@ -2459,7 +2459,6 @@ static int promex_send_headers(struct appctx *appctx, struct stream_interface *s
                goto full;
        sl->info.res.status = 200;
        if (!htx_add_header(htx, ist("Cache-Control"), ist("no-cache")) ||
-           !htx_add_header(htx, ist("Connection"), ist("close")) ||
            !htx_add_header(htx, ist("Content-Type"), ist("text/plain; version=0.0.4")) ||
            !htx_add_header(htx, ist("Transfer-Encoding"), ist("chunked")) ||
            !htx_add_endof(htx, HTX_BLK_EOH))
index 64b9cc0bc81e5b66720f515b8e0499915ac40b22..59ff82d5b9e7e0a60bf2bf13f7df4e65f1b8368c 100644 (file)
@@ -37,22 +37,12 @@ client c1 -connect ${h1_stats_sock} {
        expect resp.body ~ ".*haproxy_frontend.*"
        expect resp.body ~ ".*haproxy_backend.*"
        expect resp.body ~ ".*haproxy_server.*"
-} -run
-
-client c2 -connect ${h1_stats_sock} {
-       txreq -url "/metrics?scope"
-       rxresp
-       expect resp.status == 400
-} -run
 
-client c3 -connect ${h1_stats_sock} {
        txreq -url "/metrics?scope="
        rxresp
        expect resp.status == 200
        expect resp.bodylen == 0
-} -run
 
-client c4 -connect ${h1_stats_sock} {
        txreq -url "/metrics?scope=server"
        rxresp
        expect resp.status == 200
@@ -60,9 +50,7 @@ client c4 -connect ${h1_stats_sock} {
        expect resp.body !~ ".*haproxy_frontend.*"
        expect resp.body !~ ".*haproxy_backend.*"
        expect resp.body ~ ".*haproxy_server.*"
-} -run
 
-client c5 -connect ${h1_stats_sock} {
        txreq -url "/metrics?scope=frontend&scope=backend"
        rxresp
        expect resp.status == 200
@@ -70,4 +58,8 @@ client c5 -connect ${h1_stats_sock} {
        expect resp.body ~ ".*haproxy_frontend.*"
        expect resp.body ~ ".*haproxy_backend.*"
        expect resp.body !~ ".*haproxy_server.*"
+
+       txreq -url "/metrics?scope"
+       rxresp
+       expect resp.status == 400
 } -run