]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: config: inform the user about the deprecatedness of "block" rules
authorWilly Tarreau <w@1wt.eu>
Mon, 28 Apr 2014 20:28:02 +0000 (22:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Apr 2014 22:46:01 +0000 (00:46 +0200)
It's just a warning emitted once.

include/types/global.h
src/cfgparse.c

index 21433e86c3eb10c5dd9dabff582c9a23da7cfc85..967d3b472ed2d5565afa0ad9246c6af0a04b5239 100644 (file)
@@ -173,7 +173,7 @@ extern struct task *global_listener_queue_task;
 extern unsigned int warned;     /* bitfield of a few warnings to emit just once */
 
 /* bit values to go with "warned" above */
-/* #define WARN_* */
+#define WARN_BLOCK_DEPRECATED       0x00000001
 
 /* to be used with warned and WARN_* */
 static inline int already_warned(unsigned int warning)
index f2afcd0af830539d3d7407c95c2cc00815e9ee17..485205945fb7ae9780a7b1429e164acedc2510d6 100644 (file)
@@ -2896,6 +2896,10 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                                                  (curproxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
                                                  file, linenum);
                LIST_ADDQ(&curproxy->block_rules, &rule->list);
+
+               if (!already_warned(WARN_BLOCK_DEPRECATED))
+                       Warning("parsing [%s:%d] : The '%s' directive is now deprecated in favor of 'http-request deny' which uses the exact same syntax. The rules are translated but support might disappear in a future version.\n", file, linenum, args[0]);
+
        }
        else if (!strcmp(args[0], "redirect")) {
                struct redirect_rule *rule;