mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-07 01:41:00 +01:00
Some HTTP related stats functions need to know the parent proxy, mainly to get a pointer on the related uri_auth set by the proxy or to check scope settings. The current design (probably historical as only the http context existed by then) took the other approach: it propagates the uri pointer from the http context deep down the calling stack up to the relevant functions. For non-http contexts (cli), the pointer is set to NULL. Doing so is not very pretty and not easy to maintain. Moreover, there were still some places in the code were the uri pointer was learned directly from the stream proxy because the argument was not available as argument from those functions. This is error-prone, because if one day we decide to change the source proxy in the parent function, we might still have some functions down the stack that ignore the top most argument and still do on their own, and we'll probably end up with inconsistencies. So in this patch, we take a safer approach: the caller responsible for creating the stats applet should set the http_px pointer so that any stats function running under the applet that needs to know if it's running in http context or needs to access parent proxy info may do so thanks to the dedicated ctx->http_px pointer.