From: Willy Tarreau Date: Thu, 28 Aug 2014 18:42:57 +0000 (+0200) Subject: BUG/MEDIUM: http: fix inverted condition in pat_match_meth() X-Git-Tag: v1.6-dev1~329 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4de2a94165f25136b2b42933f17601479800bbc1;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/proto_http.c b/src/proto_http.c index 7c6a237da1..dc4787da03 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;