]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DOC: httpclient: document status 0 on internal error
authorWilliam Lallemand <wlallemand@irq6.net>
Sun, 14 Jun 2026 11:12:02 +0000 (11:12 +0000)
committerWilliam Lallemand <wlallemand@irq6.net>
Sun, 14 Jun 2026 11:19:26 +0000 (13:19 +0200)
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
doc/management.txt

index 67a7a1470ad990cfb0ac021e083f556a241820f1..926d8fe035d3b1a430326af1d6862ac877b982d8 100644 (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
index f0d4c51c3b0d717942ef8eb1e50282b4bbc687e7..d155f8d5ec7439c64cf01f28a473a697b1760a21 100644 (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.