On Thu, Feb 26, 2015 at 08:30:45AM +0100, Baptiste wrote: > >> and 2. how > >> could we write a new function in HAProxy which takes a buffer of data in > >> entry and can return a string (or buffer of data) > > > > I think that what you want to implement is a sample fetch function. For > > example, take a look at the recently introduced "req.hdr_names" function, > > which iterates over all request headers and produces a string that can be > > used to build a log line, another header or whatever. I think it will be > > straightforward enough for you to understand how to implement this with > > your lib. > > > > Best regards, > > Willy > > > > Hi Willy, > > I think a converter is more suited here. > I mean, a fetch can't take a buffer issued from the result of an other > fetch... > The idea would to configure it something like > http-request set-header Foobar > req.hdr(HEADER),mikefunction(<parameters if required>)
That's precisely what I don't find clear in Mike's description. Since he said "take a buffer of data", I assumed "use whatever is in the buffer", and then that's what a fetch does. Of course if it's just to convert strings or so, a converter is better, but that's not my understanding here. > Mike, in such case, you want to have a look at this file: > http://git.haproxy.org/?p=haproxy.git;a=blob_plain;f=src/sample.c;hb=HEAD > and with the upper and lower and any other converter functions. Absolutely. Hopfully Mike will show us what he projected to do once it's done ! Willy