Skip to content

Commit 5530f50

Browse files
committed
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.).
1 parent f371bfd commit 5530f50

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

doc/lua-api/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,8 @@ HTTPClient class
26142614
haproxy address format.
26152615
:param integer request.timeout: Optional timeout parameter, set a
26162616
"timeout server" on the connections.
2617-
:returns: Lua table containing the response
2617+
:returns: Lua table containing the response. If an internal error occurs (e.g.
2618+
connection failure, timeout, etc.), the ``status`` field will be set to 0.
26182619

26192620

26202621
.. code-block:: lua

doc/management.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,8 @@ httpclient [--htx] <method> <URI>
24692469
name in the URL using the "default" resolvers section, which is populated
24702470
with the DNS servers of your /etc/resolv.conf by default. However it won't be
24712471
able to resolve an host from /etc/hosts if you don't use a local dns daemon
2472-
which can resolve those.
2472+
which can resolve those. If an internal error occurs (e.g. connection failure,
2473+
timeout, etc.), the status code will be set to 0.
24732474

24742475
The --htx option allow to use the haproxy internal htx representation using
24752476
the htx_dump() function, mainly used for debugging.

0 commit comments

Comments
 (0)