MINOR: htx: make htx_from_buf() adjust the size only on new buffers

This one is used a lot during transfers, let's avoid resetting its
size when there are already data in the buffer since it implies the
size is correct.
This commit is contained in:
Willy Tarreau 2018-12-05 09:47:34 +01:00
parent 8706c81316
commit 8ae4235f94

View File

@ -532,9 +532,10 @@ static inline struct htx *htx_from_buf(struct buffer *buf)
if (b_is_null(buf))
return &htx_empty;
htx = (struct htx *)(buf->area);
htx->size = buf->size - sizeof(*htx);
if (!b_data(buf))
if (!b_data(buf)) {
htx->size = buf->size - sizeof(*htx);
htx_reset(htx);
}
return htx;
}