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.
This commit is contained in:
Christopher Faulet 2020-04-28 09:37:00 +02:00
parent 8bf8fda49b
commit 907701bcda
3 changed files with 7 additions and 7 deletions

View File

@ -4644,7 +4644,7 @@ http-check expect [min-recv <int>] [comment <msg>]
and "http-check send". and "http-check send".
http-check send [meth <method>] [uri <uri>] [vsn <version>] [comment <msg>] http-check send [meth <method>] [uri <uri>] [ver <version>] [comment <msg>]
[hdr <name> <fmt>]* [body <string>] [hdr <name> <fmt>]* [body <string>]
Add a possible list of headers and/or a body to the request sent during HTTP Add a possible list of headers and/or a body to the request sent during HTTP
health checks. health checks.
@ -4664,7 +4664,7 @@ http-check send [meth <method>] [uri <uri>] [vsn <version>] [comment <msg>]
any server, but may be changed to any other URI. Query any server, but may be changed to any other URI. Query
strings are permitted. strings are permitted.
vsn <version> is the optional HTTP version string. It defaults to ver <version> is the optional HTTP version string. It defaults to
"HTTP/1.0" but some servers might behave incorrectly in HTTP "HTTP/1.0" but some servers might behave incorrectly in HTTP
1.0, so turningit to HTTP/1.1 may sometimes help. Note that 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 the Host field is mandatory in HTTP/1.1, use "hdr" argument

View File

@ -103,7 +103,7 @@ haproxy h1 -conf {
backend be3 backend be3
log ${S1_addr}:${S1_port} len 2048 local0 log ${S1_addr}:${S1_port} len 2048 local0
option httpchk 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 server srv ${s3_addr}:${s3_port} check inter 100ms rise 1 fall 1
backend be4 backend be4
@ -113,11 +113,11 @@ haproxy h1 -conf {
http-check send-state http-check send-state
http-check connect addr ${s4_addr}:${s4_port} http-check connect addr ${s4_addr}:${s4_port}
http-check set-var(check.server) "str(srv)" 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 expect status 200
http-check connect addr ${s4_addr} port ${s4_port} http-check connect addr ${s4_addr} port ${s4_port}
http-check unset-var(check.server) 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 expect rstatus "^2[0-9]{2}"
http-check connect addr ${s4_addr} port ${s4_port} http-check connect addr ${s4_addr} port ${s4_port}
http-check send meth GET uri /req3 http-check send meth GET uri /req3

View File

@ -3758,7 +3758,7 @@ static struct tcpcheck_rule *parse_tcpcheck_send_http(char **args, int cur_arg,
uri = args[cur_arg]; uri = args[cur_arg];
// TODO: log-format uri // 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])) { if (!*(args[cur_arg+1])) {
memprintf(errmsg, "'%s' expects a string as argument.", args[cur_arg]); memprintf(errmsg, "'%s' expects a string as argument.", args[cur_arg]);
goto error; goto error;
@ -3799,7 +3799,7 @@ static struct tcpcheck_rule *parse_tcpcheck_send_http(char **args, int cur_arg,
} }
} }
else { 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]); args[cur_arg]);
goto error; goto error;
} }