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.
This commit is contained in:
Willy Tarreau 2014-08-28 20:42:57 +02:00
parent 7346acb6f1
commit 4de2a94165

View File

@ -9929,8 +9929,8 @@ static struct pattern *pat_match_meth(struct sample *smp, struct pattern_expr *e
continue; continue;
icase = expr->mflags & PAT_MF_IGNORE_CASE; icase = expr->mflags & PAT_MF_IGNORE_CASE;
if ((icase && strncasecmp(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)) (!icase && strncmp(pattern->ptr.str, smp->data.meth.str.str, smp->data.meth.str.len) == 0))
return pattern; return pattern;
} }
return NULL; return NULL;