Re: [PATCH 2/4] BUG/MINOR: opentracing: enable the use of http headers without a set value

2021-09-12 Thread Miroslav Zagorac

Hello Willy,

On 09/12/2021 08:19 AM, Willy Tarreau wrote:

Bah, I discovered that one after merging the first series :-/ I've
applied it on top as a cleanup with your description above as the
commit message since it's really what it's about.


It is no problem.  I apologize for the slight confusion.

--
Zaga

What can change the nature of a man?



Re: [PATCH 2/4] BUG/MINOR: opentracing: enable the use of http headers without a set value

2021-09-11 Thread Willy Tarreau
On Sat, Sep 11, 2021 at 12:27:30AM +0200, Miroslav Zagorac wrote:
> 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.  :)

Bah, I discovered that one after merging the first series :-/ I've
applied it on top as a cleanup with your description above as the
commit message since it's really what it's about.

Thanks,
Willy



Re: [PATCH 2/4] BUG/MINOR: opentracing: enable the use of http headers without a set value

2021-09-10 Thread Miroslav Zagorac

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

What can change the nature of a man?
>From 969f6e001a2ec9fe96ff3d148c0e673afdd1f13b Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac 
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



[PATCH 2/4] BUG/MINOR: opentracing: enable the use of http headers without a set value

2021-09-10 Thread Miroslav Zagorac

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.

Best regards,

--
Zaga

What can change the nature of a man?
>From 661e87f9b897924d786c887d19b211816443eed5 Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac 
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 | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/addons/ot/src/http.c b/addons/ot/src/http.c
index 4a12ed854..0ed4970e5 100644
--- a/addons/ot/src/http.c
+++ b/addons/ot/src/http.c
@@ -133,6 +133,16 @@ 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.len will be equal to 0, and
+ * the function otc_text_map_add() 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