]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] checks: http-check expect could fail a check on multi-packet responses
authorWilly Tarreau <w@1wt.eu>
Wed, 13 Apr 2011 07:32:41 +0000 (09:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 13 Apr 2011 07:32:41 +0000 (09:32 +0200)
Christopher Blencowe reported that the httpchk_expect() function was
lacking a test for incomplete responses : if the server sends only the
headers in the first packet and the body in a subsequent one, there is
a risk that the check fails without waiting for more data. A failure
rate of about 1% was reported.

This fix must be backported to 1.4.

src/checks.c

index 4285624cf32cfa45625dfa55b1df10ab8b9806aa..82aceaaa2ba2b7cfcecafe1b44d92776177d13b6 100644 (file)
@@ -1681,6 +1681,9 @@ static int httpchk_expect(struct server *s, int done)
 
                /* Check that response body is not empty... */
                if (*contentptr == '\0') {
+                       if (!done)
+                               return 0;
+
                        set_server_check_status(s, HCHK_STATUS_L7RSP,
                                                "HTTP content check found empty response body");
                        return 1;