From: Christopher Faulet Date: Mon, 31 Oct 2016 09:49:03 +0000 (+0100) Subject: MINOR: vars: Allow '.' in variable names X-Git-Tag: v1.7-dev6~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b71557a98b8c2036e47b33d8f5bb556530120c43;p=thirdparty%2Fhaproxy.git MINOR: vars: Allow '.' in variable names This is required to have implicit prefix or scope. SPOE filter will use it to keep variables set by an agent in its own namespace. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index c424e5ea23..09add066c5 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -4314,8 +4314,8 @@ http-response { allow | deny | add-header | set-nice | "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. - The name may only contain characters 'a-z', 'A-Z', '0-9' - and '_'. + The name may only contain characters 'a-z', 'A-Z', '0-9', + '.' and '_'. Is a standard HAProxy expression formed by a sample-fetch followed by some converters. @@ -9076,8 +9076,8 @@ tcp-request content [{if | unless} ] "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. - The name may only contain characters 'a-z', 'A-Z', '0-9' - and '_'. + The name may only contain characters 'a-z', 'A-Z', '0-9', + '.' and '_'. Is a standard HAProxy expression formed by a sample-fetch followed by some converters. @@ -9289,8 +9289,8 @@ tcp-response content [{if | unless} ] "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. - The name may only contain characters 'a-z', 'A-Z', '0-9' - and '_'. + The name may only contain characters 'a-z', 'A-Z', '0-9', + '.' and '_'. Is a standard HAProxy expression formed by a sample-fetch followed by some converters. @@ -12110,7 +12110,7 @@ add() "req" : the variable is shared only during request processing "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. and() Performs a bitwise "AND" between and the input value of type signed @@ -12122,7 +12122,7 @@ and() "req" : the variable is shared only during request processing "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. base64 Converts a binary input sample to a base64 string. It is used to log or @@ -12187,7 +12187,7 @@ div() "req" : the variable is shared only during request processing "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. djb2([]) Hashes a binary input sample into an unsigned 32-bit quantity using the DJB2 @@ -12395,7 +12395,7 @@ mod() "req" : the variable is shared only during request processing "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. mul() Multiplies the input value of type signed integer by , and returns @@ -12408,7 +12408,7 @@ mul() "req" : the variable is shared only during request processing "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. neg Takes the input value of type signed integer, computes the opposite value, @@ -12436,7 +12436,7 @@ or() "req" : the variable is shared only during request processing "res" : the variable is shared only during response processing This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. regsub(,[,]) Applies a regex-based substitution to the input string. It does the same @@ -12498,7 +12498,7 @@ set-var() "req" : the variable is shared only during request processing, "res" : the variable is shared only during response processing. This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. sub() Subtracts from the input value of type signed integer, and returns @@ -12512,7 +12512,7 @@ sub() "req" : the variable is shared only during request processing, "res" : the variable is shared only during response processing. This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. table_bytes_in_rate() Uses the string representation of the input sample to perform a look up in @@ -12709,7 +12709,7 @@ xor() "req" : the variable is shared only during request processing, "res" : the variable is shared only during response processing. This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. 7.3.2. Fetching samples from internal states @@ -12972,7 +12972,7 @@ var() : undefined "req" : the variable is shared only during request processing, "res" : the variable is shared only during response processing. This prefix is followed by a name. The separator is a '.'. The name may only - contain characters 'a-z', 'A-Z', '0-9' and '_'. + contain characters 'a-z', 'A-Z', '0-9', '.' and '_'. 7.3.3. Fetching samples at Layer 4 ---------------------------------- diff --git a/src/vars.c b/src/vars.c index 59c29aa3a0..e37ff74f9c 100644 --- a/src/vars.c +++ b/src/vars.c @@ -211,7 +211,7 @@ static char *register_name(const char *name, int len, enum vars_scope *scope, ch /* Check variable name syntax. */ tmp = var_names[var_names_nb - 1]; while (*tmp) { - if (!isalnum((int)(unsigned char)*tmp) && *tmp != '_') { + if (!isalnum((int)(unsigned char)*tmp) && *tmp != '_' && *tmp != '.') { memprintf(err, "invalid syntax at char '%s'", tmp); return NULL; }