]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: sample: make the bool type cast to bin
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Apr 2022 08:46:16 +0000 (10:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Apr 2022 14:09:26 +0000 (16:09 +0200)
commitb9f30f398b58ddda4f552eca465f18eb3cecfc40
tree7e0953b4f5d59e2ef287f716bcc34d4e5d36d13d
parent3705deea99ac557c74125b7302dd15082585d76c
MINOR: sample: make the bool type cast to bin

Any type except bool could cast to bin, while it can cast to string.
That's a bit inconsistent, and prevents a boolean from being used as
the entry of a hash function while any other type can. This is a
problem when passing via variable where someone could use:

    ... set-var(txn.bar) always_false

to temporarily disable something, but this would result in an empty
hash output when later doing:

    ... var(txn.bar),sdbm

Instead of using c_int2bin() as is done for the string output, better
enfore an set of inputs or exactly 0 or 1 so that a poorly written sample
fetch function does not result in a difficult to debug hash output.
src/sample.c