[sr-dev] [kamailio/kamailio] topos: enable multiple Via values in separate via header (PR #3220)
Mvondo Eric
notifications at github.com
Wed Aug 17 09:07:56 CEST 2022
Hello can you please remove the uncessary condition if (c==0 || c== 1) {} and leave only the body of that condition please and remove also the unused c variable. we dont need it.
should be like this
```
int tps_reappend_via_separate_header(sip_msg_t *msg, tps_data_t *ptsd, str *hbody)
{
str hname = str_init("Via");
int i;
str sb;
char *p = NULL;
if(hbody==NULL || hbody->s==NULL || hbody->len<=0 || hbody->s[0]=='\0')
return 0;
sb.len = 1;
p = hbody->s;
for(i=0; i<hbody->len-1; i++) {
if(hbody->s[i]==',') {
if(sb.len>0) {
sb.s = p;
if(sb.s[sb.len-1]==',') sb.len--;
if(tps_add_headers(msg, &hname, &sb, 0)<0) {
return -1;
}
}
sb.len = 0;
p = hbody->s + i + 1;
}
sb.len++;
}
if(sb.len>0) {
sb.s = p;
if(sb.s[sb.len-1]==',') sb.len--;
if(tps_add_headers(msg, &hname, &sb, 0)<0) {
return -1;
}
}
return 0;
}
```
Thanks.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3220#issuecomment-1217546116
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3220/c1217546116 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220817/060016f8/attachment.htm>
More information about the sr-dev
mailing list