From 5530f50e4bc90f3f84fcf4db8afac24a0eb1f0c1 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Sun, 14 Jun 2026 11:12:02 +0000 Subject: [PATCH] DOC: httpclient: document status 0 on internal error This patch documents the behavior where the internal HTTP client sets the response status to 0 when an error is encountered by the stream (SF_ERR_MASK). This allows users to distinguish between an HTTP status code returned by a remote server and an internal error generated by HAProxy (e.g. connection timeout, connection refused, etc.). --- doc/lua-api/index.rst | 3 ++- doc/management.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/lua-api/index.rst b/doc/lua-api/index.rst index 67a7a1470..926d8fe03 100644 --- a/doc/lua-api/index.rst +++ b/doc/lua-api/index.rst @@ -2614,7 +2614,8 @@ HTTPClient class haproxy address format. :param integer request.timeout: Optional timeout parameter, set a "timeout server" on the connections. - :returns: Lua table containing the response + :returns: Lua table containing the response. If an internal error occurs (e.g. + connection failure, timeout, etc.), the ``status`` field will be set to 0. .. code-block:: lua diff --git a/doc/management.txt b/doc/management.txt index f0d4c51c3..d155f8d5e 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -2469,7 +2469,8 @@ httpclient [--htx] name in the URL using the "default" resolvers section, which is populated with the DNS servers of your /etc/resolv.conf by default. However it won't be able to resolve an host from /etc/hosts if you don't use a local dns daemon - which can resolve those. + which can resolve those. If an internal error occurs (e.g. connection failure, + timeout, etc.), the status code will be set to 0. The --htx option allow to use the haproxy internal htx representation using the htx_dump() function, mainly used for debugging. -- 2.47.3