From: Willy Tarreau Date: Fri, 11 Jun 2021 14:01:50 +0000 (+0200) Subject: MINOR: config: reject long-deprecated "option forceclose" X-Git-Tag: v2.5-dev1~144 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ba69841f8612d09ec1320e7e82799cf525e3099;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/doc/close-options.txt b/doc/close-options.txt index 5f1c9d98f9..0554bb859c 100644 --- a/doc/close-options.txt +++ b/doc/close-options.txt @@ -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. - diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 8ac6b30b04..d014b8ce02 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -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 @@ stats_error_parsing: * 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) { diff --git a/tests/conf/test-connection.cfg b/tests/conf/test-connection.cfg index f5591dce79..a81e2f322f 100644 --- a/tests/conf/test-connection.cfg +++ b/tests/conf/test-connection.cfg @@ -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 -