BUG/MINOR: http_htx: Fix searching headers by substring
Function __http_find_header is used to search headers by name using specified
matching method. Matching by substring returned unexpected results due to wrong
length of substring supplied to strnistr function.
Fixed also the boolean condition by inverting it, as we're interested in
headers that contains the substring.
This patch should be backported as far as 2.2
(cherry picked from commit 302b9f8d7a3805bfd25ecf267a8ddd730c6887b3)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/http_htx.c b/src/http_htx.c
index d3c3f42..63e9dc2 100644
--- a/src/http_htx.c
+++ b/src/http_htx.c
@@ -201,7 +201,7 @@
goto next_blk;
break;
case HTTP_FIND_FL_MATCH_SUB:
- if (strnistr(n.ptr, n.len, name.ptr, n.len) != NULL)
+ if (!strnistr(n.ptr, n.len, name.ptr, name.len))
goto next_blk;
break;
default: