diff --git a/addons/ot/include/parser.h b/addons/ot/include/parser.h index 5e7b298d5..75a39cc0c 100644 --- a/addons/ot/include/parser.h +++ b/addons/ot/include/parser.h @@ -38,6 +38,7 @@ #define FLT_OT_PARSE_SPAN_REF_CHILD "child-of" #define FLT_OT_PARSE_SPAN_REF_FOLLOWS "follows-from" #define FLT_OT_PARSE_CTX_AUTONAME "-" +#define FLT_OT_PARSE_CTX_IGNORE_NAME '-' #define FLT_OT_PARSE_CTX_USE_HEADERS "use-headers" #define FLT_OT_PARSE_CTX_USE_VARS "use-vars" #define FLT_OT_PARSE_OPTION_HARDERR "hard-errors" diff --git a/addons/ot/src/http.c b/addons/ot/src/http.c index 72b31b76f..4a12ed854 100644 --- a/addons/ot/src/http.c +++ b/addons/ot/src/http.c @@ -99,6 +99,19 @@ struct otc_text_map *flt_ot_http_headers_get(struct channel *chn, const char *pr if (chn == NULL) FLT_OT_RETURN(retptr); + /* + * The keyword 'inject' allows you to define the name of the OpenTracing + * context without using a prefix. In that case all HTTP headers are + * transferred because it is not possible to separate them from the + * OpenTracing context (this separation is usually done via a prefix). + * + * When using the 'extract' keyword, the context name must be specified. + * To allow all HTTP headers to be extracted, the first character of + * that name must be set to FLT_OT_PARSE_CTX_IGNORE_NAME. + */ + if (FLT_OT_STR_ISVALID(prefix) && (*prefix == FLT_OT_PARSE_CTX_IGNORE_NAME)) + prefix_len = 0; + htx = htxbuf(&(chn->buf)); for (pos = htx_get_first(htx); pos != -1; pos = htx_get_next(htx, pos)) {