[sr-dev] git:master:65336276: topos: skip comma at the end when reinserting rr headers

Daniel-Constantin Mierla miconda at gmail.com
Fri Aug 5 08:28:53 CEST 2016


Module: kamailio
Branch: master
Commit: 65336276f219454210556b36f3d37a0e957d9c1c
URL: https://github.com/kamailio/kamailio/commit/65336276f219454210556b36f3d37a0e957d9c1c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-08-05T08:27:41+02:00

topos: skip comma at the end when reinserting rr headers

- reported by GH #716

---

Modified: modules/topos/tps_msg.c

---

Diff:  https://github.com/kamailio/kamailio/commit/65336276f219454210556b36f3d37a0e957d9c1c.diff
Patch: https://github.com/kamailio/kamailio/commit/65336276f219454210556b36f3d37a0e957d9c1c.patch

---

diff --git a/modules/topos/tps_msg.c b/modules/topos/tps_msg.c
index 2f398e8..ecc67ef 100644
--- a/modules/topos/tps_msg.c
+++ b/modules/topos/tps_msg.c
@@ -629,6 +629,7 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev)
 				c = 1;
 				if(sb.len>0) {
 					sb.s = hbody->s + i + 1;
+					if(sb.s[sb.len-1]==',') sb.len--;
 					if(tps_add_headers(msg, &hname, &sb, 0)<0) {
 						return -1;
 					}
@@ -640,6 +641,7 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev)
 		if(c==1) {
 			if(sb.len>0) {
 				sb.s = hbody->s;
+				if(sb.s[sb.len-1]==',') sb.len--;
 				if(tps_add_headers(msg, &hname, &sb, 0)<0) {
 					return -1;
 				}
@@ -648,7 +650,9 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev)
 		}
 	}
 
-	if(tps_add_headers(msg, &hname, hbody, 0)<0) {
+	sb = *hbody;
+	if(sb.s[sb.len-1]==',') sb.len--;
+	if(tps_add_headers(msg, &hname, &sb, 0)<0) {
 		return -1;
 	}
 




More information about the sr-dev mailing list