Browse code

core: append_branch(): avoid identical branches

If append_branch() is used from the script, try to avoid having 2
identical branches (one for the main ruri and one because of the
append_branch()). In this case the ruri will be marked as consumed.

Reported-by: Daniel-Constantin Mierla <miconda@gmail.com>
Reported-and-tested-by: Miklos Tirpak <miklos@iptel.org>

Andrei Pelinescu-Onciul authored on 11/09/2010 06:24:23
Showing 1 changed files
... ...
@@ -549,6 +549,11 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
549 549
 			ret=append_branch(msg, &a->val[0].u.str, &msg->dst_uri,
550 550
 								&msg->path_vec, a->val[1].u.number,
551 551
 								(flag_t)flags, msg->force_send_socket);
552
+			/* if the uri is the ruri and q was also not changed, mark
553
+			   ruri as consumed, to avoid having an identical branch */
554
+			if ((a->val[0].u.str.s == 0 || a->val[0].u.str.len == 0) &&
555
+					a->val[1].u.number == Q_UNSPECIFIED)
556
+				ruri_mark_consumed();
552 557
 			break;
553 558
 
554 559
 		/* jku begin: is_length_greater_than */