When a L7 retry is performed, we should not rely on b_xfer() to swap the L7
buffer with the request buffer. When it is performed the request buffer is
not allocated. b_xfer() must not be called with an unallocated destination
buffer. The swap remains an optim. For instance, It is not performed on
buffers of different size. So the caller is responsible to provide an
allocated destination buffer with enough free space to transfer data.
However, when a L7 retry is performed, we cannot allocate a request buffer,
because we cannot yield. An error was reported, if we wait for a buffer, the
error will be handled by process_stream(). But we can swap the buffers by
hand. At this stage, we know there is no request buffer, so we can easily
swap it with the L7 buffer.
Note there is no real bug for now.
This patch could be backported to all stable versions.
}
b_free(&req->buf);
+
/* Swap the L7 buffer with the channel buffer */
/* We know we stored the co_data as b_data, so get it there */
co_data = b_data(&s->txn->l7_buffer);
b_set_data(&s->txn->l7_buffer, b_size(&s->txn->l7_buffer));
- b_xfer(&req->buf, &s->txn->l7_buffer, b_data(&s->txn->l7_buffer));
+
+ req->buf = s->txn->l7_buffer;
+ s->txn->l7_buffer = BUF_NULL;
co_set_data(req, co_data);
DBG_TRACE_DEVEL("perform a L7 retry", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, s->txn);