]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DOC: lua: update doc according with the last Lua changes
authorThierry FOURNIER <tfournier@arpalert.org>
Thu, 1 Oct 2015 13:00:42 +0000 (15:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 2 Oct 2015 20:56:11 +0000 (22:56 +0200)
The impact of the register_action() was not repported.

doc/lua-api/index.rst

index 54eae8fa8c8c9dd3107815f86752190ea559e97c..05f222c957efe72c0952a2cae999577ba7419855 100644 (file)
@@ -43,11 +43,9 @@ functions. Lua have 6 execution context.
    like this: `function fcn()`.
 
 4. The **action context**. It is an Lua function conditionally executed. These
-   actions are declared by the HAProxy directives "`tcp-request content lua
-   <function>`", "`tcp-response content lua <function>`", "`http-request lua
-   <function>`" and "`http-response lua <function>`". The prototype of the
-   Lua called function is a function with doesn't returns anything and that take
-   an object of class TXN as entry. `function fcn(txn)`
+   actions are registered by the Lua directives "`core.register_action()`". The
+   prototype of the Lua called function is a function with doesn't returns
+   anything and that take an object of class TXN as entry. `function fcn(txn)`.
 
 5. The **sample-fetch context**. This function takes a TXN object as entry
    argument and returns a string. These types of function cannot execute any
@@ -80,16 +78,16 @@ HAProxy configuration file (`hello_world.conf`):
 
     listen proxy
        bind 127.0.0.1:10001
-       tcp-request content lua hello_world
+       tcp-request inspect-delay 1s
+       tcp-request content use-service lua.hello_world
 
 HAProxy Lua file (`hello_world.lua`):
 
 .. code-block:: lua
 
-    function hello_world(txn)
-       txn.res:send("hello world\n")
-       txn:done()
-    end
+    core.register_service("hello_world", "tcp", function(applet)
+       applet:send("hello world\n")
+    end)
 
 How to start HAProxy for testing this configuration: