MINOR: opentracing: correct calculation of the number of arguments in the args[]
authorMiroslav Zagorac <mzagorac@haproxy.com>
Wed, 14 Apr 2021 09:44:58 +0000 (11:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 15 Apr 2021 06:40:05 +0000 (08:40 +0200)
commit4b3eb0a9408bacb0703bb6081c11ffa3d3a0d45e
tree3a2cdccf09bebee7fb7e05c335596f37b3c73146
parentc037fcf56fc8b60520422218720f0887f158dae2
MINOR: opentracing: correct calculation of the number of arguments in the args[]

It is possible that some arguments within the configuration line are not
specified; that is, they are set to a blank string.

For example:
  keyword '' arg_2

In that case the content of the args field will be like this:
  args[0]:                  'keyword'
  args[1]:                  NULL pointer
  args[2]:                  'arg_2'
  args[3 .. MAX_LINE_ARGS): NULL pointers

The previous way of calculating the number of arguments (as soon as a
null pointer is encountered) could not place an argument on an empty
string.

All of the above is essential for passing the OpenTracing context via
the HTTP headers (keyword 'inject'), where one of the arguments is the
context name prefix.  This way we can set an empty prefix, which is very
useful if we get context from some other process that can't add a prefix
to that data; or we want to pass the context to some process that cannot
handle the prefix of that data.
addons/ot/src/parser.c
addons/ot/src/util.c