mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
BUG/MINOR: channel/htx: Don't alter channel during forward for empty HTX message
In channel_htx_forward() and channel_htx_forward_forever(), if the HTX message is empty, the underlying buffer may be really empty too. And we have no warranty the caller will call htx_to_buf() later. And in practice, it is almost never done. So the channel's buffer must not be altered. Otherwise, the buffer may be considered as full (data == size) for an empty HTX message and no outgoing data. This patch must be backported to 1.9.
This commit is contained in:
parent
65674662b4
commit
a4f9dd4a56
@ -383,20 +383,21 @@ static inline void channel_add_input(struct channel *chn, unsigned int len)
|
|||||||
|
|
||||||
static inline unsigned long long channel_htx_forward(struct channel *chn, struct htx *htx, unsigned long long bytes)
|
static inline unsigned long long channel_htx_forward(struct channel *chn, struct htx *htx, unsigned long long bytes)
|
||||||
{
|
{
|
||||||
unsigned long long ret;
|
unsigned long long ret = 0;
|
||||||
|
|
||||||
b_set_data(&chn->buf, htx->data);
|
if (htx->data) {
|
||||||
ret = channel_forward(chn, bytes);
|
b_set_data(&chn->buf, htx->data);
|
||||||
b_set_data(&chn->buf, b_size(&chn->buf));
|
ret = channel_forward(chn, bytes);
|
||||||
|
b_set_data(&chn->buf, b_size(&chn->buf));
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void channel_htx_forward_forever(struct channel *chn, struct htx *htx)
|
static inline void channel_htx_forward_forever(struct channel *chn, struct htx *htx)
|
||||||
{
|
{
|
||||||
b_set_data(&chn->buf, htx->data);
|
c_adv(chn, htx->data - co_data(chn));
|
||||||
channel_forward_forever(chn);
|
chn->to_forward = CHN_INFINITE_FORWARD;
|
||||||
b_set_data(&chn->buf, b_size(&chn->buf));
|
|
||||||
}
|
}
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* These functions are used to compute various channel content sizes */
|
/* These functions are used to compute various channel content sizes */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user