TT#131050 pv_headers: pvh_set_header, remove values to set null when necessary

* fix pvh_set_xavi for SR_XTYPE_NULL

Change-Id: I358c6abf9cf589b10eca56edd74ad2db7f26a2f8
(cherry picked from commit d4035aa8e5)
mr8.5.3
Victor Seva 4 years ago committed by Donat Zenichev
parent e7f4988826
commit db6539eded

@ -80,6 +80,7 @@ upstream/tm-use-q-field-comparison-in-while-for-standard-t-co.patch
# upstream master (5.5)
upstream/ndb_redis-set-message-level-to-debug-on-reconnect.patch
upstream/pv_headers-fix-removal-of-all-values-on-when-using-P.patch
upstream/pv_headers-pvh_set_header-remove-values-to-set-null-.patch
### relevant for upstream
#
sipwise/pua_dialoginfo-refresh_pubruri_avps_flag.patch

@ -0,0 +1,39 @@
From: Victor Seva <vseva@sipwise.com>
Date: Tue, 27 Jul 2021 13:13:36 +0200
Subject: [PATCH] pv_headers: pvh_set_header, remove values to set null when
necessary
* fix pvh_set_xavi for SR_XTYPE_NULL
---
src/modules/pv_headers/pvh_xavp.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c
index ae773e5..17cfdd1 100644
--- a/src/modules/pv_headers/pvh_xavp.c
+++ b/src/modules/pv_headers/pvh_xavp.c
@@ -374,7 +374,7 @@ int pvh_set_xavi(struct sip_msg *msg, str *xname, str *name, void *data,
LM_DBG("br_xname: %.*s name: %.*s append:%d\n",
br_xname.len, br_xname.s, name->len, name->s, append);
memset(&xval, 0, sizeof(sr_xval_t));
- if(data == NULL || SR_XTYPE_NULL) {
+ if(data == NULL || type == SR_XTYPE_NULL) {
xval.type = SR_XTYPE_NULL;
} else if(type == SR_XTYPE_STR) {
xval.type = SR_XTYPE_STR;
@@ -630,9 +630,11 @@ int pvh_set_header(
if(val == NULL || (val->flags & PV_VAL_NULL)) {
if(idxf == PV_IDX_ALL) {
- cnt = xavi_rm_by_name(hname, 1, &avi);
- LM_DBG("removed %d values of %.*s=>%.*s, set $null\n",
- cnt, xavi->name.len, xavi->name.s, hname->len, hname->s);
+ if(hname_cnt > 1) {
+ cnt = xavi_rm_by_name(hname, 1, &avi);
+ LM_DBG("removed %d values of %.*s=>%.*s, set $null\n",
+ cnt, xavi->name.len, xavi->name.s, hname->len, hname->s);
+ }
if(pvh_set_xavi(msg, &xavi_name, hname, NULL, SR_XTYPE_NULL, 0, 0)
< 0)
goto err;
Loading…
Cancel
Save