Re: missing date() fetcher in lua api in haproxy 2.2

2020-08-07 Thread Christopher Faulet

Le 31/07/2020 à 15:42, Christopher Faulet a écrit :

Le 29/07/2020 à 01:29, James Brown a écrit :

In earlier versions of haproxy, the txn.f object had a `date()` method when
called from a fetch context which returned the current unix timestamp. In
HAproxy 2.2, this method is removed.


[...]

My best guess is that this is related to ae6f125c


You're right, the date() method if no longer exposed because of this commit.
This is obviously unexpected. But not so simple to fix. In fact, some sample
fetches have a check function to validate arguments. If this function is
considered as unsafe, mainly because some arguments may be freed, the sample
fetch is ignored when the lua global context is initialized.

I guess it may be fixed by duplicating argument strings when necessary. This way
all fetches could be exposed. I'll try to work on it.



FYI, I pushed a patchset in the 2.3-dev to fix this issue. It was trickier than 
expected. But at the end, the lua now exports all fetches and converters, except 
map converters because the map cannot be loaded at runtime. It is not really a 
problem because a Map class is exposed by HAproxy.


I will wait a bit for the backports to be sure not to break anything.


--
Christopher Faulet



Re: missing date() fetcher in lua api in haproxy 2.2

2020-07-31 Thread Christopher Faulet

Le 29/07/2020 à 01:29, James Brown a écrit :
In earlier versions of haproxy, the txn.f object had a `date()` method when 
called from a fetch context which returned the current unix timestamp. In 
HAproxy 2.2, this method is removed.



[...]
My best guess is that this is related to ae6f125c 


You're right, the date() method if no longer exposed because of this commit. 
This is obviously unexpected. But not so simple to fix. In fact, some sample 
fetches have a check function to validate arguments. If this function is 
considered as unsafe, mainly because some arguments may be freed, the sample 
fetch is ignored when the lua global context is initialized.


I guess it may be fixed by duplicating argument strings when necessary. This way 
all fetches could be exposed. I'll try to work on it.


--
Christopher Faulet