MEDIUM: sample: add the da-csv converter
This diff declares the deviceatlas module and can accept up to 5 property names for the API lookup. [wt: this should probably be moved to its own file using the keyword registration mechanism]
This commit is contained in:
parent
88d13cbf4d
commit
4542b10ae1
@ -10728,6 +10728,20 @@ crc32([<avalanche>])
|
||||
not be used for security purposes as a 32-bit hash is trivial to break. See
|
||||
also "djb2", "sdbm", "wt6" and the "hash-type" directive.
|
||||
|
||||
da-csv(<prop>[,<prop>*])
|
||||
Asks the DeviceAtlas converter to identify the User Agent string passed on
|
||||
input, and to emit a string made of the concatenation of the properties
|
||||
enumerated in argument, delimited by the separator defined by the global
|
||||
keyword "deviceatlas-property-separator", or by default the pipe character
|
||||
('|'). There's a limit of 5 different properties imposed by the haproxy
|
||||
configuration language.
|
||||
|
||||
Example:
|
||||
frontend www
|
||||
bind *:8881
|
||||
default_backend servers
|
||||
http-request set-header X-DeviceAtlas-Data %[req.fhdr(User-Agent),da-csv(primaryHardwareType,osName,osVersion,browserName,browserVersion)]
|
||||
|
||||
div(<value>)
|
||||
Divides the input value of type unsigned integer by <value>, and returns the
|
||||
result as an unsigned integer. If <value> is null, the largest unsigned
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include <proto/sample.h>
|
||||
#include <proto/stick_table.h>
|
||||
|
||||
#ifdef USE_DEVICEATLAS
|
||||
#include <import/da.h>
|
||||
#endif
|
||||
|
||||
/* sample type names */
|
||||
const char *smp_to_type[SMP_TYPES] = {
|
||||
[SMP_T_BOOL] = "bool",
|
||||
@ -2278,6 +2282,9 @@ static struct sample_conv_kw_list sample_conv_kws = {ILH, {
|
||||
{ "div", sample_conv_arith_div, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT },
|
||||
{ "mod", sample_conv_arith_mod, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT },
|
||||
{ "neg", sample_conv_arith_neg, 0, NULL, SMP_T_UINT, SMP_T_UINT },
|
||||
#ifdef USE_DEVICEATLAS
|
||||
{ "da-csv", da_haproxy, ARG5(1,STR,STR,STR,STR,STR), NULL, SMP_T_STR, SMP_T_STR },
|
||||
#endif
|
||||
|
||||
{ NULL, NULL, 0, 0, 0 },
|
||||
}};
|
||||
|
Loading…
x
Reference in New Issue
Block a user