...
|
...
|
@@ -1604,7 +1604,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
|
1604
|
1604
|
/* lumps length */
|
1605
|
1605
|
for(lump=msg->reply_lump;lump;lump=lump->next) {
|
1606
|
1606
|
len += lump->text.len;
|
1607
|
|
- if (lump->type==LUMP_RPL_BODY && lump->text.s && lump->text.len)
|
|
1607
|
+ if (lump->type==LUMP_RPL_BODY)
|
1608
|
1608
|
body = lump;
|
1609
|
1609
|
}
|
1610
|
1610
|
/* server header */
|
...
|
...
|
@@ -1617,11 +1617,11 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
|
1617
|
1617
|
else LOG(L_WARN, "WARNING: warning skipped -- too big\n");
|
1618
|
1618
|
}
|
1619
|
1619
|
/* content length hdr */
|
1620
|
|
- len += CONTENT_LENGTH_LEN + 1/*0*/ + CRLF_LEN;
|
1621
|
|
- /* body */
|
1622
|
1620
|
if (body) {
|
1623
|
1621
|
content_len.s = int2str(body->text.len, &content_len.len);
|
1624
|
|
- len += content_len.len - 1 + body->text.len;
|
|
1622
|
+ len += CONTENT_LENGTH_LEN + content_len.len + CRLF_LEN;
|
|
1623
|
+ } else {
|
|
1624
|
+ len += CONTENT_LENGTH_LEN + 1/*0*/ + CRLF_LEN;
|
1625
|
1625
|
}
|
1626
|
1626
|
/* end of message */
|
1627
|
1627
|
len += CRLF_LEN; /*new line*/
|
...
|
...
|
@@ -1744,16 +1744,13 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
|
1744
|
1744
|
p+=CRLF_LEN;
|
1745
|
1745
|
}
|
1746
|
1746
|
/* content_length hdr */
|
1747
|
|
- memcpy(p, CONTENT_LENGTH, CONTENT_LENGTH_LEN );
|
1748
|
|
- p+=CONTENT_LENGTH_LEN;
|
1749
|
1747
|
if (content_len.len) {
|
1750
|
|
- memcpy( p, content_len.s, content_len.len );
|
1751
|
|
- p+=content_len.len;
|
|
1748
|
+ append_str( p, CONTENT_LENGTH, CONTENT_LENGTH_LEN);
|
|
1749
|
+ append_str( p, content_len.s, content_len.len );
|
|
1750
|
+ append_str( p, CRLF, CRLF_LEN );
|
1752
|
1751
|
} else {
|
1753
|
|
- *(p++) = '0';
|
|
1752
|
+ append_str( p, CONTENT_LENGTH"0"CRLF,CONTENT_LENGTH_LEN+1+CRLF_LEN);
|
1754
|
1753
|
}
|
1755
|
|
- memcpy( p, CRLF, CRLF_LEN );
|
1756
|
|
- p+=CRLF_LEN;
|
1757
|
1754
|
/* warning header */
|
1758
|
1755
|
if (warning.s) {
|
1759
|
1756
|
memcpy( p, warning.s, warning.len);
|