]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: log-format: make the LF parser aware of sample expressions' end
authorWilly Tarreau <w@1wt.eu>
Fri, 14 Feb 2020 16:33:06 +0000 (17:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Feb 2020 18:02:06 +0000 (19:02 +0100)
commitcd0d2ed6ee932e0d86b8fbaf5fcb97d9530bf260
tree6f63b752c13298fdcdedd997ec2dfc2765f86420
parente3b57bf92f279b56ed78d8ca55ff0b637e46755c
MEDIUM: log-format: make the LF parser aware of sample expressions' end

For a very long time it used to be impossible to pass a closing square
bracket as a valid character in argument to a sample fetch function or
to a converter because the LF parser used to stop on the first such
character found and to pass what was between the first '[' and the first
']' to sample_parse_expr().

This patch addresses this by passing the whole string to sample_parse_expr()
which is the only one authoritative to indicate the first character that
does not belong to the expression. The LF parser then verifies it matches
a ']' or fails. As a result it is finally possible to write rules such as
the following, which is totally valid an unambigous :

    http-request redirect location %[url,regsub([.:/?-],!,g)]
                                                |-----| | |
                                                  arg1  | `---> arg3
                                                        `-----> arg2
                                         |-----------------|
                                              converter
                                     |---------------------|
                                        sample expression
                                   |------------------------|
                                         log-format tag
doc/configuration.txt
src/log.c