where parameters are delimited by <delim>, which defaults to "&", and the name
and value of the parameter are separated by a "=". If there is no "=" and
value before the end of the parameter segment, it is treated as equivalent to
- a value of an empty string.
+ a value of an empty string. The delimiter must be either a single character,
+ or it can be the hexadecimal encoding of the delimiter's ASCII code in the
+ form "0xHH" (either upper or lower case). The hex form may sometimes be
+ needed to represent a NUL character or more generally control characters that
+ cannot be expressed in the configuration, and that can be found in request
+ bodies (see req.body).
This can be useful for extracting parameters from a query string, or possibly
a x-www-form-urlencoded body. In particular, `query,param(<name>)` can be used
### requests
http-request set-var(txn.query) query
- http-response set-header Found %[var(txn.query),param(test)] if { var(txn.query),param(test) -m found }
+ http-response set-header Found %[var(txn.query),param(test)] if { var(txn.query),param(test,0x26) -m found }
default_backend be
static int sample_conv_param_check(struct arg *arg, struct sample_conv *conv,
const char *file, int line, char **err)
{
+ if (arg[1].type == ARGT_STR && arg[1].data.str.data == 4 &&
+ strncmp(arg[1].data.str.area, "0x", 2) == 0) {
+ /* 0x can be decoded */
+ char *err = NULL;
+ int i = strtol(arg[1].data.str.area, &err, 0);
+
+ if (!err || !*err) {
+ arg[1].data.str.area[0] = i;
+ arg[1].data.str.data = 1;
+ return 1;
+ }
+ /* otherwise fall back to the error message */
+ }
+
if (arg[1].type == ARGT_STR && arg[1].data.str.data != 1) {
- memprintf(err, "Delimiter must be exactly 1 character.");
+ memprintf(err, "Delimiter must be either exactly 1 character, or 0xHH for an ASCII code .");
return 0;
}