BUG/MEDIUM: httpclient: channel_add_input() must use htx->data
authorWilliam Lallemand <wlallemand@haproxy.org>
Mon, 8 Nov 2021 15:55:14 +0000 (16:55 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Mon, 8 Nov 2021 16:36:31 +0000 (17:36 +0100)
commitdb8a1f391dbbf1072f76bdb01d86d4032b84e6ac
tree2f661b2c1674469ad5dbbb39972deb7e176123a0
parent933fe394bb11490d45fd231b43b7cd93a0cf21e4
BUG/MEDIUM: httpclient: channel_add_input() must use htx->data

The httpclient uses channel_add_input() to notify the channel layer that
it must forward some data. This function was used with b_data(&req->buf)
which ask to send the size of a buffer (because of the HTX metadata
which fill the buffer completely).

This is wrong and will have the consequence of trying to send data that
doesn't exist, letting HAProxy looping at 100% CPU.

When using htx channel_add_input() must be used with the size of the htx
payload, and not the size of a buffer.

When sending the request payload it also need to sets the buffer size to
0, which is achieved with a htx_to_buf() when the htx payload is empty.
src/http_client.c