From 4de2a94165f25136b2b42933f17601479800bbc1 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 28 Aug 2014 20:42:57 +0200 Subject: [PATCH] BUG/MEDIUM: http: fix inverted condition in pat_match_meth() This results in a string-based HTTP method match returning true when it doesn't match and conversely. This bug was reported by Joe Williams. The fix must be backported to 1.5, though it still doesn't work because of at least 3-4 other bugs in the long path which leads to building this pattern list. --- src/proto_http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/proto_http.c b/src/proto_http.c index 7c6a237..dc4787d 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -9929,8 +9929,8 @@ static struct pattern *pat_match_meth(struct sample *smp, struct pattern_expr *e continue; icase = expr->mflags & PAT_MF_IGNORE_CASE; - if ((icase && strncasecmp(pattern->ptr.str, smp->data.meth.str.str, smp->data.meth.str.len) != 0) || - (!icase && strncmp(pattern->ptr.str, smp->data.meth.str.str, smp->data.meth.str.len) != 0)) + if ((icase && strncasecmp(pattern->ptr.str, smp->data.meth.str.str, smp->data.meth.str.len) == 0) || + (!icase && strncmp(pattern->ptr.str, smp->data.meth.str.str, smp->data.meth.str.len) == 0)) return pattern; } return NULL; -- 1.7.10.4