Skip to content

Commit

Permalink
pv_headers: pvh_set_header, remove values to set null when necessary
Browse files Browse the repository at this point in the history
* fix pvh_set_xavi for SR_XTYPE_NULL

(cherry picked from commit af92651)
  • Loading branch information
linuxmaniac committed Jul 27, 2021
1 parent e18c24b commit d20841d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/modules/pv_headers/pvh_xavp.c
Expand Up @@ -375,7 +375,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;
Expand Down Expand Up @@ -618,9 +618,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;
Expand Down

0 comments on commit d20841d

Please sign in to comment.