rate-limits are valid for both frontend and listen, but not backend; so
we can simplify this check in a similar manner as it is done in e.g
max-keep-alive-queue.

this should fix github issue #449

Signed-off-by: William Dauchy <w.dau...@criteo.com>
---
 src/proxy.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/proxy.c b/src/proxy.c
index 8720b2880..aed32f94b 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -330,7 +330,7 @@ static int proxy_parse_rate_limit(char **args, int section, 
struct proxy *proxy,
                                   struct proxy *defpx, const char *file, int 
line,
                                   char **err)
 {
-       int retval, cap;
+       int retval;
        char *res;
        unsigned int *tv = NULL;
        unsigned int *td = NULL;
@@ -341,7 +341,6 @@ static int proxy_parse_rate_limit(char **args, int section, 
struct proxy *proxy,
        if (strcmp(args[1], "sessions") == 0) {
                tv = &proxy->fe_sps_lim;
                td = &defpx->fe_sps_lim;
-               cap = PR_CAP_FE;
        }
        else {
                memprintf(err, "'%s' only supports 'sessions' (got '%s')", 
args[0], args[1]);
@@ -359,10 +358,9 @@ static int proxy_parse_rate_limit(char **args, int 
section, struct proxy *proxy,
                return -1;
        }
 
-       if (!(proxy->cap & cap)) {
-               memprintf(err, "%s %s will be ignored because %s '%s' has no %s 
capability",
-                        args[0], args[1], proxy_type_str(proxy), proxy->id,
-                        (cap & PR_CAP_BE) ? "backend" : "frontend");
+       if (!(proxy->cap & PR_CAP_FE)) {
+               memprintf(err, "%s %s will be ignored because %s '%s' has no 
frontend capability",
+                         args[0], args[1], proxy_type_str(proxy), proxy->id);
                retval = 1;
        }
        else if (defpx && *tv != *td) {
-- 
2.24.1


Reply via email to