BUG/MINOR: checks: chained expect will not properly wait for enough data

TCP check expect matching strings or binary patterns are able to know
prior to applying their match function whether the available data is
already sufficient to attempt the match or not.

As such, on insufficient data the expect is postponed. This behavior
avoids unnecessary matches when the data could not possibly match.

When chaining expect, upon passing the previous and going onto the next
however, this length check is not done again. Then the match is done and
will necessarily fail, triggering a new wait for more data. The end
result is the same for a slightly higher cost.

Check received data length for all expects in a chain.

This bug exists since the introduction of the feature:
Fixes: 5ecb77f4c76f ("MEDIUM: checks: add send/expect tcp based check")
Version 1.5+ impacted.

(cherry picked from commit 738ee76aa7a9968cb9c9610725c26622c50f0b33)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 68997cc14bf6f16ff862a6d44a506b85263ad557)
Signed-off-by: Willy Tarreau <w@1wt.eu>
1 file changed