DOC: httpclient: document status 0 on internal error
Some checks are pending
Contrib / admin/halog/ (push) Waiting to run
Contrib / dev/flags/ (push) Waiting to run
Contrib / dev/haring/ (push) Waiting to run
Contrib / dev/hpack/ (push) Waiting to run
Contrib / dev/poll/ (push) Waiting to run
FreeBSD / clang (push) Waiting to run
VTest / Generate Build Matrix (push) Waiting to run
VTest / (push) Blocked by required conditions
Windows / Windows, gcc, all features (push) Waiting to run

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.).
This commit is contained in:
William Lallemand 2026-06-14 11:12:02 +00:00
parent f371bfd608
commit 5530f50e4b
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -2469,7 +2469,8 @@ httpclient [--htx] <method> <URI>
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.