at append I was passing delimiter with already '--' at the begining.

generate_boundary was adding two more. So msg_translator was unable to detect it

Change-Id: I9fe58eea0f815cd9b974e9a8899b6042501adc20
vseva/6243_fix
Victor Seva 11 years ago
parent 2f6fd648fa
commit f4f15fc35c

@ -134,7 +134,7 @@
{
unsigned int i = 0;
str cth = {"Content-Type: ", 14};
@@ -1464,7 +1464,9 @@
@@ -1464,32 +1464,42 @@
str* n;
unsigned int flag = 0;
@ -145,7 +145,14 @@
{
LM_ERR("invalid parameters\n");
return NULL;
@@ -1475,21 +1477,25 @@
}
+ if (delimiter->s[0] == '-') {
+ LM_ERR("delimiter with initial '-'. Invalid parameter.\n");
+ return NULL;
+ }
n = pkg_malloc(sizeof(str));
if(n==NULL)
{
LM_ERR("out of pkg memory\n");
return NULL;
}
@ -178,7 +185,7 @@
n->s = pkg_malloc(sizeof(char)*(n->len));
if(n->s==0)
{
@@ -1497,31 +1503,32 @@
@@ -1497,31 +1507,32 @@
pkg_free(n);
return NULL;
}
@ -218,7 +225,7 @@
memcpy(n->s+i, CRLF, CRLF_LEN); i=i+CRLF_LEN;
if(i!=n->len)
@@ -1668,7 +1675,7 @@
@@ -1668,7 +1679,7 @@
}
/* get initial boundary */
@ -227,14 +234,16 @@
if(nbb==NULL)
{
LM_ERR("couldn't create initial boundary\n");
@@ -1857,12 +1864,14 @@
@@ -1857,19 +1868,20 @@
LM_ERR("WTF\n");
return -1;
}
- /* get boundary */
- if(get_boundary(msg, &delimiter)!=0) {
+ LM_DBG("body<%d|%d>[%.*s] off<%d>\n",
+ body.len, get_content_length(msg), body.len, body.s, off);
/* get boundary */
if(get_boundary(msg, &delimiter)!=0) {
+ /* get delimiter no initial -- */
+ if(get_mixed_part_delimiter(&msg->content_type->body, &delimiter) < 0) {
LM_ERR("Cannot get boundary. Is body multipart?\n");
return -1;
}
@ -243,15 +252,15 @@
if(nbb==NULL)
{
LM_ERR("couldn't create initial boundary\n");
@@ -1870,6 +1879,7 @@
- pkg_free(delimiter.s);
return -1;
}
pkg_free(delimiter.s);
- pkg_free(delimiter.s);
+ LM_DBG("nbb<%d>[%.*s]\n", nbb->len ,nbb->len, nbb->s);
if(insert_new_lump_after(l, nbb->s, nbb->len, 0)==0){
LM_ERR("could not insert new lump\n");
pkg_free(nbb->s); pkg_free(nbb);
@@ -1881,6 +1891,7 @@
@@ -1881,6 +1893,7 @@
LM_DBG("set flag FL_BODY_MULTIPART\n");
msg->msg_flags |= FL_BODY_MULTIPART;
}

Loading…
Cancel
Save