MINOR: config: reject long-deprecated "option forceclose"

It's been warning as being deprecated since 2.0-dev4, it's about time
to drop it now. The error message recommends to either remove it or
use "option httpclose" instead. It's still referred to in the old
internal doc about the connection header, which itself seems highly
inaccurate by now.
This commit is contained in:
Willy Tarreau 2021-06-11 16:01:50 +02:00
parent 4a83977283
commit 6ba69841f8
3 changed files with 16 additions and 31 deletions

View File

@ -1,7 +1,6 @@
2011/04/20 - List of keep-alive / close options with associated behaviours.
PK="http-pretend-keepalive", HC="httpclose", SC="http-server-close",
FC = "forceclose".
0 = option not set
1 = option is set
@ -12,16 +11,14 @@ a meaning only when combined by associating a frontend to a backend. Some forms
are not the normal ones and provide a behaviour compatible with another normal
form. Those are considered alternate forms and are marked "(alt)".
FC SC HC PK Behaviour
0 0 0 X tunnel mode
0 0 1 0 passive close, only set headers then tunnel
0 0 1 1 forced close with keep-alive announce (alt)
0 1 0 0 server close
0 1 0 1 server close with keep-alive announce
0 1 1 0 forced close (alt)
0 1 1 1 forced close with keep-alive announce (alt)
1 * * 0 forced close
1 * * 1 forced close with keep-alive announce
SC HC PK Behaviour
0 0 X tunnel mode
0 1 0 passive close, only set headers then tunnel
0 1 1 forced close with keep-alive announce (alt)
1 0 0 server close
1 0 1 server close with keep-alive announce
1 1 0 forced close (alt)
1 1 1 forced close with keep-alive announce (alt)
At this point this results in 4 distinct effective modes for a request being
processed :
@ -40,7 +37,3 @@ Note: "http-pretend-keepalive" alone has no effect. However, if it is set in a
both will result in a forced close with keep-alive announces for requests
passing through both.
It is also worth noting that "option httpclose" alone has become useless since
1.4, because "option forceclose" does the right thing, while the former only
pretends to do the right thing. Both options might get merged in the future.

View File

@ -56,7 +56,7 @@ static const char *common_kw_list[] = {
};
static const char *common_options[] = {
"httpclose", "forceclose", "http-server-close", "http-keep-alive",
"httpclose", "http-server-close", "http-keep-alive",
"http-tunnel", "redispatch", "httplog", "tcplog", "tcpka", "httpchk",
"ssl-hello-chk", "smtpchk", "pgsql-check", "redis-check",
"mysql-check", "ldap-check", "spop-check", "tcp-check",
@ -1937,13 +1937,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
* was this one (useful for cancelling options set in defaults
* sections).
*/
if (strcmp(args[1], "httpclose") == 0 || strcmp(args[1], "forceclose") == 0) {
if (strcmp(args[1], "forceclose") == 0) {
if (!already_warned(WARN_FORCECLOSE_DEPRECATED))
ha_warning("parsing [%s:%d]: keyword '%s' is deprecated in favor of 'httpclose', and will not be supported by future versions.\n",
file, linenum, args[1]);
err_code |= ERR_WARN;
}
if (strcmp(args[1], "forceclose") == 0) {
ha_alert("parsing [%s:%d]: option '%s' is not supported any more since HAProxy 2.0, please just remove it, or use 'option httpclose' if absolutely needed.\n",
file, linenum, args[1]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
else if (strcmp(args[1], "httpclose") == 0) {
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
goto out;
if (kwm == KWM_STD) {

View File

@ -32,11 +32,3 @@ listen httpclose_server-close
server srv 127.0.0.1:8080
http-request add-header X-request mode=httpclose+server-close
http-response add-header X-response mode=httpclose+server-close
listen forceclose
option forceclose
bind :8004
server srv 127.0.0.1:8080
http-request add-header X-request mode=forceclose
http-response add-header X-response mode=forceclose