On 09/11/2021 12:05 AM, Miroslav Zagorac wrote:
Hello all,
the second patch from the last series of patches has been redesigned
here, the ist() function is used to set an empty string instead of
working directly with the string pointer.
I thank Tim Düsterhus for his advice.
The operation comment has been slightly corrected.
Sorry to bother you. :)
--
Zaga <[email protected]>
What can change the nature of a man?
>From 969f6e001a2ec9fe96ff3d148c0e673afdd1f13b Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac <[email protected]>
Date: Thu, 9 Sep 2021 01:23:42 +0200
Subject: [PATCH 2/4] BUG/MINOR: opentracing: enable the use of http headers
without a set value
In case we transfer some data that does not have a set value via the HTTP
header, adding that header in the text map was done incorrectly.
This simple patch allows the use of HTTP headers without a set value.
---
addons/ot/src/http.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/addons/ot/src/http.c b/addons/ot/src/http.c
index 4a12ed854..0d824ddb5 100644
--- a/addons/ot/src/http.c
+++ b/addons/ot/src/http.c
@@ -133,6 +133,17 @@ struct otc_text_map *flt_ot_http_headers_get(struct channel *chn, const char *pr
v = htx_get_blk_value(htx, blk);
+ /*
+ * In case the data of the HTTP header is not
+ * specified, v.ptr will have some non-null
+ * value and v.len will be equal to 0. The
+ * otc_text_map_add() function will not
+ * interpret this well. In this case v.ptr
+ * is set to an empty string.
+ */
+ if (v.len == 0)
+ v = ist("");
+
/*
* Here, an HTTP header (which is actually part
* of the span context is added to the text_map.
--
2.30.1