]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: reject long-deprecated "option forceclose"
authorWilly Tarreau <w@1wt.eu>
Fri, 11 Jun 2021 14:01:50 +0000 (16:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 Jun 2021 14:57:34 +0000 (16:57 +0200)
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.

doc/close-options.txt
src/cfgparse-listen.c
tests/conf/test-connection.cfg

index 5f1c9d98f941bfcece97343edfe2d32abcd9bf82..0554bb859c69b7a10fde2232771cc8dffafc1b32 100644 (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.
-
index 8ac6b30b0422683bf84cfb774d08ff8246d1f656..d014b8ce0257a48892921b1f04c4563d4f5e0828 100644 (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 @@ 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) {
index f5591dce79c5144210f87d5ad2722e2bc2c3d4c4..a81e2f322fc11fbd0d036f40f93ee19474b340b2 100644 (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
-