SIGN IN SIGN UP

CLEANUP: http-conv: index the captures array with hdr->index in the converters

smp_conv_req_capture() and smp_conv_res_capture() look the capture slot up by
walking the proxy's capture list backwards until the decreasing counter matches
the requested id, then allocate the storage using <hdr->index> but write it
using <idx>:

	if (smp->strm->req_cap[hdr->index] == NULL)
		smp->strm->req_cap[hdr->index] = pool_alloc(hdr->pool);
	...
	memcpy(smp->strm->req_cap[idx], smp->data.u.str.area, len);

Both are in fact always equal, because every place that appends to the list
(cfgparse-listen.c, proxy.c, tcp_rules.c and http_act.c) does "hdr->next = px->
req_cap; hdr->index = px->nb_req_cap++; px->req_cap = hdr;", so the head always
carries the highest index and the walk keeps hdr->index == i. But relying on
that invariant to index an array while the neighbouring lines use the field that
actually describes the slot is confusing, and it silently ties these two
functions to the way the list happens to be built.

Let's use hdr->index everywhere. No functional change.
W
Willy Tarreau committed
449d4e581c6b47621d6a3cfd925fa587c640bee4
Parent: f571e23
Committed by Christopher Faulet <cfaulet@haproxy.com> on 7/27/2026, 1:32:11 PM