Browse code

topos: enable multiple Via values in separate via header

emvondo authored on 17/08/2022 10:05:54
Showing 1 changed files
... ...
@@ -636,20 +636,16 @@ int tps_reappend_via_separate_header(sip_msg_t *msg, tps_data_t *ptsd, str *hbod
636 636
 {
637 637
         str hname = str_init("Via");
638 638
         int i;
639
-        int c;
640 639
         str sb;
641 640
         char *p = NULL;
642 641
 
643 642
         if(hbody==NULL || hbody->s==NULL || hbody->len<=0 || hbody->s[0]=='\0')
644 643
             return 0;
645 644
 
646
-
647
-        c = 0;
648 645
         sb.len = 1;
649 646
         p = hbody->s;
650 647
         for(i=0; i<hbody->len-1; i++) {
651 648
             if(hbody->s[i]==',') {
652
-                c = 1;
653 649
                 if(sb.len>0) {
654 650
                     sb.s = p;
655 651
                     if(sb.s[sb.len-1]==',') sb.len--;
... ...
@@ -663,16 +659,16 @@ int tps_reappend_via_separate_header(sip_msg_t *msg, tps_data_t *ptsd, str *hbod
663 659
             sb.len++;
664 660
         }
665 661
 
666
-        if(c==0 || c== 1) {
667
-            if(sb.len>0) {
662
+
663
+        if(sb.len>0) {
668 664
                 sb.s = p;
669 665
                 if(sb.s[sb.len-1]==',') sb.len--;
670 666
                 if(tps_add_headers(msg, &hname, &sb, 0)<0) {
671 667
                     return -1;
672 668
                 }
673
-            }
674 669
         }
675 670
 
671
+
676 672
         return 0;
677 673
 }
678 674