From: William Lallemand Date: Fri, 20 Aug 2021 09:35:29 +0000 (+0200) Subject: BUG/MINOR: httpclient/cli: change the appctx test in the callbacks X-Git-Tag: v2.5-dev5~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dfc3f8906d0be94aa0ffe6779309b5d0af369e52;p=thirdparty%2Fhaproxy.git BUG/MINOR: httpclient/cli: change the appctx test in the callbacks The callbacks of the CLI httpclient are testing the appctx pointer before doing the appctx_wakeup but was dereferencing the appctx pointer before. --- diff --git a/src/http_client.c b/src/http_client.c index 7e950f96cb..89d7d76672 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -64,36 +64,44 @@ void hc_cli_res_stline_cb(struct httpclient *hc) { struct appctx *appctx = hc->caller; + if (!appctx) + return; + appctx->ctx.cli.i0 |= HC_CLI_F_RES_STLINE; - if (appctx) - appctx_wakeup(appctx); + appctx_wakeup(appctx); } void hc_cli_res_headers_cb(struct httpclient *hc) { struct appctx *appctx = hc->caller; + if (!appctx) + return; + appctx->ctx.cli.i0 |= HC_CLI_F_RES_HDR; - if (appctx) - appctx_wakeup(appctx); + appctx_wakeup(appctx); } void hc_cli_res_body_cb(struct httpclient *hc) { struct appctx *appctx = hc->caller; + if (!appctx) + return; + appctx->ctx.cli.i0 |= HC_CLI_F_RES_BODY; - if (appctx) - appctx_wakeup(appctx); + appctx_wakeup(appctx); } void hc_cli_res_end_cb(struct httpclient *hc) { struct appctx *appctx = hc->caller; + if (!appctx) + return; + appctx->ctx.cli.i0 |= HC_CLI_F_RES_END; - if (appctx) - appctx_wakeup(appctx); + appctx_wakeup(appctx); } /*