BUG/MEDIUM: http-act: ignore "capture len" rules evaluated from a backend
An "http-request capture <expr> len <n>" rule creates a capture slot in the
proxy it is declared in. The parser only refuses it in proxies without the
frontend capability, so it is accepted in a "listen" section. But the
capture slots of a stream are allocated from its frontend (s->req_cap is
sized from fe->nb_req_cap), and released through the frontend's capture list
with the frontend's pools.
So when the listen section is also used as the backend of another frontend,
the rule runs with an index taken from the listen's numbering on the slot
array of the other frontend:
- if this frontend has no capture, s->req_cap is NULL and the first
request crashes the process;
- otherwise the slot aliases one of the frontend's slots, it is allocated
from the listen's pool and later released to the frontend's pool, which
corrupts the pools. It may also be beyond the end of the slot array.
The slot cannot exist for such streams, so the rule is now ignored when the
proxy evaluating it is not the stream's frontend. This cannot be detected at
parsing time since a backend may be resolved at run time. The documentation
is updated and a reg-test is added.
This must be backported to all supported versions.