From f371bfd608b39d2e3c25ca941dd621a4ee3166f1 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Sun, 14 Jun 2026 10:46:38 +0200 Subject: [PATCH] MEDIUM: httpclient: set res.status to 0 upon SF_ERR_MASK With the httpclient it's difficult to get if the HTTP status code was returned by the actual server or if it's the internal proxy that generate the error. This patch changes the behavior by setting the status to 0 when an error is get by the stream. There were already valid cases when the status was 0 on some error, so that should not really change the error path in the scripts. --- src/http_client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/http_client.c b/src/http_client.c index c1937c471..fa205f0f0 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -688,6 +688,10 @@ void httpclient_applet_io_handler(struct appctx *appctx) /* copy the status line in the httpclient */ hc->res.status = sl->info.res.status; + + if (__sc_strm(appctx_sc(appctx))->flags & SF_ERR_MASK) + hc->res.status = 0; + hc->res.vsn = istdup(htx_sl_res_vsn(sl)); hc->res.reason = istdup(htx_sl_res_reason(sl)); htx_remove_blk(htx, blk); -- 2.47.3