]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http: fix inverted condition in pat_match_meth()
authorWilly Tarreau <w@1wt.eu>
Thu, 28 Aug 2014 18:42:57 +0000 (20:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 Aug 2014 18:42:57 +0000 (20:42 +0200)
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

index 7c6a237da15e6481c9af1381bf64445581c2329a..dc4787da034e386551ec4a494555f05ad7925536 100644 (file)
@@ -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;