MINOR: sample: improve error reporting on missing arg to strcmp() converter
authorWilly Tarreau <w@1wt.eu>
Sat, 8 May 2021 04:50:28 +0000 (06:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 8 May 2021 04:55:25 +0000 (06:55 +0200)
commita1169b6231a03e61f253b5144ae8e604e20453b3
tree4bdb8490e8ea4940dec50d2db3b09775ed1f7a43
parent02bd68431b8b4ccf81121806658eb096a148f119
MINOR: sample: improve error reporting on missing arg to strcmp() converter

Calling the strcmp() converter with no argument yields this strange error:

  [ALERT]    (31439) : parsing [test.cfg:3] : error detected in frontend 'f' while parsing 'http-request redirect' rule : failed to parse sample expression <src,strcmp]> : invalid args in converter 'strcmp' : failed to register variable name ''.

This is because the vars name check tries to see if it can create such a
variable having an empty name. Let's at least make a special case of the
missing argument. Now we can read a more explicit:

  [ALERT]    (31655) : parsing [test.cfg:3] : error detected in frontend 'f' while parsing 'http-request redirect' rule : failed to parse sample expression <src,strcmp]> : invalid args in converter 'strcmp' : missing variable name.

This was done for secure_strcmp() as well.
src/sample.c