BUG/MINOR: http-check: Preserve headers if not redefined by an implicit rule

When an explicit "http-check send" rule is used, if it is the first one, it
is merge with the implicit rule created by "option httpchk" statement. The
opposite is also true. Idea is to have only one send rule with the merged
info. It means info defined in the second rule override those defined in the
first one. However, if an element is not defined in the second rule, it must
be ignored, keeping this way info from the first rule. It works as expected
for the method, the uri and the request version. But it is not true for the
header list.

For instance, with the following statements, a x-forwarded-proto header is
added to healthcheck requests:

  option httpchk
  http-check send meth GET hdr x-forwarded-proto https

while by inverting the statements, no extra headers are added:

  http-check send meth GET hdr x-forwarded-proto https
  option httpchk

Now the old header list is overriden if the new one is not empty.

This patch should fix the issue #1772. It must be backported as far as 2.2.

(cherry picked from commit 4c8e58def6042081af4a721db8d53ca91b335a38)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 284b90a1c48e10bbdbea3d1531b93958762016ec)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f7cd0c66a3c54b863c1ea52f3a1477c712db0942)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed