Browse code

- some final tunnings

Bogdan-Andrei Iancu authored on 11/09/2003 22:26:16
Showing 1 changed files
... ...
@@ -1582,9 +1582,8 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1582 1582
 						len+=new_tag->len-to_tag.len;
1583 1583
 					else
1584 1584
 						len+=new_tag->len+TOTAG_TOKEN_LEN/*";tag="*/;
1585
-				} else {
1586
-					len += hdr->len;
1587 1585
 				}
1586
+				len += hdr->len;
1588 1587
 				break;
1589 1588
 			case HDR_VIA:
1590 1589
 				/* we always add CRLF to via*/
... ...
@@ -1652,7 +1651,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1652 1652
 	memcpy( p, CRLF, CRLF_LEN );
1653 1653
 	p+=CRLF_LEN;
1654 1654
 	/* headers*/
1655
-	for ( hdr=msg->headers ; hdr ; hdr=hdr->next )
1655
+	for ( hdr=msg->headers ; hdr ; hdr=hdr->next ) {
1656 1656
 		switch (hdr->type)
1657 1657
 		{
1658 1658
 			case HDR_VIA:
... ...
@@ -1729,7 +1728,8 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1729 1729
 			case HDR_CALLID:
1730 1730
 			case HDR_CSEQ:
1731 1731
 					append_str(p, hdr->name.s, hdr->len);
1732
-		} /* for switch */
1732
+		} /* end switch */
1733
+	} /* end for */
1733 1734
 	/* lumps */
1734 1735
 	for(lump=msg->reply_lump;lump;lump=lump->next)
1735 1736
 		if (lump->type==LUMP_RPL_HDR){
... ...
@@ -1770,6 +1770,9 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1770 1770
 		p+=body->text.len;
1771 1771
 	}
1772 1772
 
1773
+	if (len!=p-buf)
1774
+		LOG(L_CRIT,"BUGGGG!!!! diff len=%d p-buf=%d\n",len,p-buf);
1775
+
1773 1776
 	*(p) = 0;
1774 1777
 	*returned_len = len;
1775 1778
 	/* in req2reply, received_buf is not introduced to lumps and