]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DOC: lua: Add a warning about buffers modification in HTTP
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Jun 2021 09:43:18 +0000 (11:43 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Jun 2021 10:03:32 +0000 (12:03 +0200)
Since the 1.9, it is forbidden to alter the channel buffer from an HTTP
stream because there is no way to keep the HTTP parser synchronized if the
buffer content is altered. In addition, since the HTX is the only
reprensentation for HTTP messages, the data in HTTP buffers are structured
and cannot be read or updated in a raw fashion.

A warning is triggered when a user tries to alter an HTTP buffer. However,
it was not documented. This patch adds a warning in the lua documentation.

This patch is related to the issue #1287. It may be backported as far as
2.0.

doc/lua-api/index.rst

index e0bda2dc89631f145909e72faca19491a4a121ef..d98c77eeb472d7573c68a1455a9583361143105c 100644 (file)
@@ -1281,6 +1281,10 @@ Channel class
   **Warning**: It is not possible to read from the response in request action,
   and it is not possible to read for the request channel in response action.
 
+  **Warning**: It is forbidden to alter the Channels buffer from HTTP contexts.
+  So only :js:func:`Channel.get_in_length`, :js:func:`Channel.get_out_length`
+  and :js:func:`Channel.is_full` can be called from an HTTP conetext.
+
 .. image:: _static/channel.png
 
 .. js:function:: Channel.dup(channel)