Skip to content

Commit ef2a292

Browse files
committed
BUG/MINOR: http-ana: Swap L7 buffer with request buffer by hand
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.
1 parent ba7dc46 commit ef2a292

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/http_ana.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,11 +1224,14 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *sc)
12241224
}
12251225

12261226
b_free(&req->buf);
1227+
12271228
/* Swap the L7 buffer with the channel buffer */
12281229
/* We know we stored the co_data as b_data, so get it there */
12291230
co_data = b_data(&s->txn->l7_buffer);
12301231
b_set_data(&s->txn->l7_buffer, b_size(&s->txn->l7_buffer));
1231-
b_xfer(&req->buf, &s->txn->l7_buffer, b_data(&s->txn->l7_buffer));
1232+
1233+
req->buf = s->txn->l7_buffer;
1234+
s->txn->l7_buffer = BUF_NULL;
12321235
co_set_data(req, co_data);
12331236

12341237
DBG_TRACE_DEVEL("perform a L7 retry", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, s->txn);

0 commit comments

Comments
 (0)