]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: agent doesn't get the response if server does not closes
authorWilly Tarreau <w@1wt.eu>
Wed, 11 Dec 2013 20:40:11 +0000 (21:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 11 Dec 2013 20:43:09 +0000 (21:43 +0100)
The agent refrains from reading the server's response until the server
closes, but if the server waits for the client to close, the response
is never read. Let's try to fetch a whole line before deciding to wait
more.

src/checks.c

index 3b4e917acbb97739a40efee923635f9616b8ae78..4af3db726178f54815b7e8d6098a0ec4a218a8fb 100644 (file)
@@ -1138,11 +1138,22 @@ static void event_srv_chk_r(struct connection *conn)
                const char *desc = "Unknown feedback string";
                const char *down_cmd = NULL;
                int disabled;
+               char *p;
 
-               if (!done)
-                       goto wait_more_data;
+               /* get a complete line first */
+               p = check->bi->data;
+               while (*p && *p != '\n' && *p != '\r')
+                       p++;
+
+               if (!*p) {
+                       if (!done)
+                               goto wait_more_data;
 
-               cut_crlf(check->bi->data);
+                       /* at least inform the admin that the agent is mis-behaving */
+                       set_server_check_status(check, check->status, "Ignoring incomplete line from agent");
+                       break;
+               }
+               *p = 0;
 
                /*
                 * The agent may have been disabled after a check was