From: Christopher Faulet Date: Tue, 28 Apr 2020 07:37:00 +0000 (+0200) Subject: MINOR: checks: Use ver keyword to specify the HTTP version for http checks X-Git-Tag: v2.2-dev7~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=907701bcdac1253461ec41c7957bb2217af2cbff;p=thirdparty%2Fhaproxy.git MINOR: checks: Use ver keyword to specify the HTTP version for http checks 'ver' keyword is already used by sample fetches while 'vsn' is not used anywhere else. So better to use 'ver' too for http-check send rules. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 6e39c89d9b..1348891bb9 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -4644,7 +4644,7 @@ http-check expect [min-recv ] [comment ] and "http-check send". -http-check send [meth ] [uri ] [vsn ] [comment ] +http-check send [meth ] [uri ] [ver ] [comment ] [hdr ]* [body ] Add a possible list of headers and/or a body to the request sent during HTTP health checks. @@ -4664,7 +4664,7 @@ http-check send [meth ] [uri ] [vsn ] [comment ] any server, but may be changed to any other URI. Query strings are permitted. - vsn is the optional HTTP version string. It defaults to + ver is the optional HTTP version string. It defaults to "HTTP/1.0" but some servers might behave incorrectly in HTTP 1.0, so turningit to HTTP/1.1 may sometimes help. Note that the Host field is mandatory in HTTP/1.1, use "hdr" argument diff --git a/reg-tests/checks/http-check.vtc b/reg-tests/checks/http-check.vtc index 7d8d514428..057484f24c 100644 --- a/reg-tests/checks/http-check.vtc +++ b/reg-tests/checks/http-check.vtc @@ -103,7 +103,7 @@ haproxy h1 -conf { backend be3 log ${S1_addr}:${S1_port} len 2048 local0 option httpchk - http-check send meth GET uri /status vsn HTTP/1.1 + http-check send meth GET uri /status ver HTTP/1.1 server srv ${s3_addr}:${s3_port} check inter 100ms rise 1 fall 1 backend be4 @@ -113,11 +113,11 @@ haproxy h1 -conf { http-check send-state http-check connect addr ${s4_addr}:${s4_port} http-check set-var(check.server) "str(srv)" - http-check send meth GET uri /req1 vsn HTTP/1.1 hdr x-test "server=%[var(check.server)]" + http-check send meth GET uri /req1 ver HTTP/1.1 hdr x-test "server=%[var(check.server)]" http-check expect status 200 http-check connect addr ${s4_addr} port ${s4_port} http-check unset-var(check.server) - http-check send meth GET uri /req2 vsn HTTP/1.1 hdr x-test "server=%[var(check.server)]" body "health-check body" + http-check send meth GET uri /req2 ver HTTP/1.1 hdr x-test "server=%[var(check.server)]" body "health-check body" http-check expect rstatus "^2[0-9]{2}" http-check connect addr ${s4_addr} port ${s4_port} http-check send meth GET uri /req3 diff --git a/src/checks.c b/src/checks.c index 0b934b6637..4279290b3f 100644 --- a/src/checks.c +++ b/src/checks.c @@ -3758,7 +3758,7 @@ static struct tcpcheck_rule *parse_tcpcheck_send_http(char **args, int cur_arg, uri = args[cur_arg]; // TODO: log-format uri } - else if (strcmp(args[cur_arg], "vsn") == 0) { + else if (strcmp(args[cur_arg], "ver") == 0) { if (!*(args[cur_arg+1])) { memprintf(errmsg, "'%s' expects a string as argument.", args[cur_arg]); goto error; @@ -3799,7 +3799,7 @@ static struct tcpcheck_rule *parse_tcpcheck_send_http(char **args, int cur_arg, } } else { - memprintf(errmsg, "expects 'comment', 'meth', 'uri', 'hdr' and 'body' but got '%s' as argument.", + memprintf(errmsg, "expects 'comment', 'meth', 'uri', 'ver', 'hdr' and 'body' but got '%s' as argument.", args[cur_arg]); goto error; }