BUG/MEDIUM: httpclient: Don't set EOM flag on an empty HTX message
In the HTTP client, when the request body is streamed, at the end of the payload, we must be sure to not set the EOM flag on an empty message. Otherwise, because there is no data, the buffer is reset to be released and the flag is lost. Thus, the HTTP client is never notified of the end of payload for the request and the applet is blocked. If the HTTP client is instanciated from a Lua script, it is even worse because we fall into a wakeup loop between the lua script and the HTTP client applet. At the end, HAProxy is killed because of the watchdog. This patch should fix the issue #1898. It must be backported to 2.6.
This commit is contained in:
parent
48e46f98cc
commit
48005de17c
|
@ -421,6 +421,16 @@ int httpclient_req_xfer(struct httpclient *hc, struct ist src, int end)
|
|||
|
||||
/* if we copied all the data and the end flag is set */
|
||||
if ((istlen(src) == ret) && end) {
|
||||
/* no more data are expected. If the HTX buffer is empty, be
|
||||
* sure to add something (EOT block in this case) to have
|
||||
* something to send. It is important to be sure the EOM flags
|
||||
* will be handled by the endpoint. Because the message is
|
||||
* empty, this should not fail. Otherwise it is an error
|
||||
*/
|
||||
if (htx_is_empty(htx)) {
|
||||
if (!htx_add_endof(htx, HTX_BLK_EOT))
|
||||
goto error;
|
||||
}
|
||||
htx->flags |= HTX_FL_EOM;
|
||||
}
|
||||
htx_to_buf(htx, &hc->req.buf);
|
||||
|
|
Loading…
Reference in New Issue