Re: [PATCH] Re: Question re lua and tcp content

2019-01-07 Thread Willy Tarreau
On Sun, Jan 06, 2019 at 07:46:15PM +0100, Thierry Fournier wrote:
> Hi,
> 
> Thanks fir the bug report. It is fixed by attached patch.
> 
> Willy, could you merge this patch ?

Sure, now applied, thanks!

Willy



[PATCH] Re: Question re lua and tcp content

2019-01-06 Thread Thierry Fournier
Hi,

Thanks fir the bug report. It is fixed by attached patch.

Willy, could you merge this patch ?

Thanks,
Thierry


0001-BUG-MINOR-bad-args-are-returned-for-Lua-actions.patch
Description: Binary data



> On 31 Dec 2018, at 18:53, FRANKS, Andy (SHREWSBURY AND TELFORD HOSPITAL NHS 
> TRUST)  wrote:
> 
> Hi all,
>   I’m an amateur with lua. I’ve been messing around with doing “something” 
> when either an http or tcp request happens as a way of teaching myself how to 
> do stuff.
> Many examples use the “hello world” lua script, and call it via either :
>  
> http-request lua.script
>  
> or 
>  
> tcp-request content lua.script
>  
> Which works fine; the script is called. My question though is around 
> arguments .. I understand the txn  gets passed over, so one can use a 
> script like this for example:
>  
> Function my_script(txn)
>   ip=txn.f:src()
>   core.Alert(ip)
> end
>  
> core.register_action(“my-script”, {“tcp-req”, “http-req”}, my_script)
>  
> .. and it works, but if we pass arguments, e.g.
>  
> http-request lua.script stuff
> or
> tcp-request content lua.script stuff
>  
> and in the script use 
>  
> Function my_script(txn, arg)
>   core.Alert(arg)
> end
> core.register_action(“my-script”, {“tcp-req”, “http-req”}, my_script, 1)
>  
> .. http works as expected, and sends the string “stuff”, but tcp just sends 
> the word “content”, not “stuff”
>  
> Am I missing something really obvious here!?
>  
> Thanks
> Andy
>  
>  
> 
> 
> 
> 
> This message may contain confidential information. If you are not the 
> intended recipient please inform the
> sender that you have received the message in error before deleting it.
> Please do not disclose, copy or distribute information in this e-mail or take 
> any action in relation to its contents. To do so is strictly prohibited and 
> may be unlawful. Thank you for your co-operation.
> 
> NHSmail is the secure email and directory service available for all NHS staff 
> in England and Scotland. NHSmail is approved for exchanging patient data and 
> other sensitive information with NHSmail and other accredited email services.
> 
> For more information and to find out how you can switch, 
> https://portal.nhs.net/help/joiningnhsmail



Question re lua and tcp content

2018-12-31 Thread FRANKS, Andy (SHREWSBURY AND TELFORD HOSPITAL NHS TRUST)
Hi all,
  I'm an amateur with lua. I've been messing around with doing "something" when 
either an http or tcp request happens as a way of teaching myself how to do 
stuff.
Many examples use the "hello world" lua script, and call it via either :

http-request lua.script

or

tcp-request content lua.script

Which works fine; the script is called. My question though is around arguments 
.. I understand the txn  gets passed over, so one can use a script like 
this for example:

Function my_script(txn)
  ip=txn.f:src()
  core.Alert(ip)
end

core.register_action("my-script", {"tcp-req", "http-req"}, my_script)

.. and it works, but if we pass arguments, e.g.

http-request lua.script stuff
or
tcp-request content lua.script stuff

and in the script use

Function my_script(txn, arg)
  core.Alert(arg)
end
core.register_action("my-script", {"tcp-req", "http-req"}, my_script, 1)

.. http works as expected, and sends the string "stuff", but tcp just sends the 
word "content", not "stuff"

Am I missing something really obvious here!?

Thanks
Andy






This message may contain confidential information. If you are not the intended 
recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take 
any action in relation to its contents. To do so is strictly prohibited and may 
be unlawful. Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff 
in England and Scotland. NHSmail is approved for exchanging patient data and 
other sensitive information with NHSmail and other accredited email services.

For more information and to find out how you can switch, 
https://portal.nhs.net/help/joiningnhsmail