1
0
Fork 0

*** empty log message ***

This commit is contained in:
bagyenda 2007-04-20 17:01:24 +00:00
parent e3aabcccfe
commit b5aa2c8e63
3 changed files with 36 additions and 8 deletions

View File

@ -272,17 +272,17 @@ MSoapMsg_t *mm7_parse_soap(List *headers, Octstr *body)
MIMEEntity *c = NULL;
int i, n;
char *loc = octstr_get_cstr(cloc);
if (octstr_case_search(cloc, octstr_imm("cid:"), 0) == 0) /* skip 'cid:' part. */
loc += 4; /* XXX This should always be there, but some MMC don't put it there. */
for (i = 0, n = mime_entity_num_parts(mime); i<n; i++) {
MIMEEntity *x = mime_entity_get_part(mime, i);
List *headers = mime_entity_headers(x);
Octstr *y = headers ? http_header_value(headers, octstr_imm("Content-ID")) : NULL;
char *cid = (y && octstr_get_char(y, 0) == '<') ? octstr_get_cstr(y) + 1 : (y ? octstr_get_cstr(y) : "");
int cid_len = (y && octstr_get_char(y, 0) == '<') ? octstr_len(y) - 2 : (y ? octstr_len(y) : 0);
if (y &&
(strncmp(loc, cid, cid_len) == 0 ||
octstr_compare(y, cloc) == 0)) /* XXX seems wrong, but some MMC out there behave badly, so we support it */
@ -294,12 +294,38 @@ MSoapMsg_t *mm7_parse_soap(List *headers, Octstr *body)
mime_entity_destroy(x);
if (c)
break;
}
}
if (c)
msg = c; /* this is already a copy. */
octstr_destroy(cloc);
octstr_destroy(cloc);
} else {
/* XXX Sigh! Broken MMC don't set this parameter. Lets try to be kind to them! */
int i, n = mime_entity_num_parts(mime);
int found = 0;
for (i = 0; !found && i < n; i++) {
MIMEEntity *x = mime_entity_get_part(mime,i);
List *hx = NULL;
Octstr *xctype = NULL, *xparams = NULL;
if (!x)
goto loop;
hx = mime_entity_headers(x);
get_content_type(hx, &xctype, &xparams);
if (xctype && octstr_case_compare(xctype, octstr_imm("text/xml")) != 0) {
/* Found something that might be the body, since its not XML.
* Perhaps we compare bodies? For broken ones anyway, so no bother!
*/
found = 1;
msg = x;
}
loop:
if (x && !found) mime_entity_destroy(x);
if (hx) http_destroy_headers(hx);
octstr_destroy(xctype);
octstr_destroy(xparams);
}
}
smsg = gw_malloc(sizeof *smsg);
smsg->envelope = h;
smsg->msg = msg;

View File

@ -22,7 +22,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_LIBSSL
#include <openssl/md5.h>
#endif
#include "mms_util.h"
#include "mms_queue.h"
#include "mms_uaprof.h"

View File

@ -905,7 +905,7 @@ static int sendMsg(MmsEnvelope *e)
info(0, "%s MMSBox Outgoing Queue MMS Send: From %s, to %s, msgsize=%ld: err=%s",
SEND_ERROR_STR(res),
octstr_get_cstr(e->from), octstr_get_cstr(to->rcpt), e->msize,
err ? octstr_get_cstr(err) : "(null)");
err ? octstr_get_cstr(err) : "(none)");
e->lasttry = tnow;