1
0
Fork 0

added matching of .3g2 file extension

This commit is contained in:
bagyenda 2007-08-27 15:31:23 +00:00
parent aea228ecc2
commit 89a6e5007d
2 changed files with 24 additions and 43 deletions

View File

@ -125,10 +125,8 @@ static int decode_multipart(ParseContext *context, List *body)
warning(0, "Parse error reading mime body [hlen=%d, dlen=%d, left=%d]!",
hlen,dlen, pleft);
mime_entity_destroy(x);
if (content_type)
octstr_destroy(content_type);
if (content)
octstr_destroy(content);
octstr_destroy(content_type);
octstr_destroy(content);
return -1;
}
@ -152,11 +150,9 @@ static int decode_multipart(ParseContext *context, List *body)
gwlist_destroy(ml, (gwlist_item_destructor_t *)mime_entity_destroy);
if (res < 0) {
if (content_type)
octstr_destroy(content_type);
if (content)
octstr_destroy(content);
return -1;
octstr_destroy(content_type);
octstr_destroy(content);
return -1;
}
} else
mime_entity_set_body(x,content);
@ -433,9 +429,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type,
case MMS_HEADER_DELIVERY_TIME:
case MMS_HEADER_EXPIRY:
case MMS_HEADER_REPLY_CHARGING_DEADLINE:
case MMS_HEADER_REPLY_CHARGING_DEADLINE:
if (ret != WSP_FIELD_VALUE_DATA)
warning(0, "Error in value format, field %s!",
hname);
@ -594,7 +588,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type,
}
http_header_add(unpacked, (char *)hname, (char *)ch);
if (decoded) octstr_destroy(decoded);
octstr_destroy(decoded);
return val;
value_error:
@ -925,7 +919,7 @@ static void mms_pack_well_known_field(Octstr *os, int field_type, Octstr *value)
warning(0, "MMS: Unknown header with code 0x%02x!", field_type);
}
if (encoded) octstr_destroy(encoded);
octstr_destroy(encoded);
return;
}
@ -1106,8 +1100,8 @@ MmsMsg *mms_frombinary(Octstr *msg, Octstr *from)
if (s &&
octstr_search(s, octstr_imm("application/vnd.wap.multipart"), 0) == 0)
_m.ismultipart = 1;
if (s)
octstr_destroy(s);
octstr_destroy(s);
s = http_header_value(_m.headers, octstr_imm("X-Mms-Message-Type"));
if (s) {
@ -1133,15 +1127,13 @@ MmsMsg *mms_frombinary(Octstr *msg, Octstr *from)
if (!m) { /* This means an error occurred. Delete the interim stuff. */
MmsMsg *msg = &_m;
if (msg->ismultipart && msg->body.l)
if (msg->ismultipart)
gwlist_destroy(msg->body.l, (gwlist_item_destructor_t *)mime_entity_destroy);
else if (msg->body.s)
else
octstr_destroy(msg->body.s);
if (msg->headers)
http_destroy_headers(msg->headers);
if (msg->msgId)
octstr_destroy(msg->msgId);
http_destroy_headers(msg->headers);
octstr_destroy(msg->msgId);
}
return m;
}
@ -1257,8 +1249,8 @@ static void convert_mime_msg(MIMEEntity *m)
octstr_destroy(value);
}
if (h)
http_destroy_headers(h);
http_destroy_headers(h);
octstr_destroy(params);
if ((n = mime_entity_num_parts(m)) > 0)
for (i = 0; i < n; i++) {
@ -1301,9 +1293,7 @@ static void unconvert_mime_msg(MIMEEntity *m)
strip_boundary_element(h,s);
mime_replace_headers(m, h);
http_destroy_headers(h);
if (params)
octstr_destroy(params);
octstr_destroy(params);
if ((n = mime_entity_num_parts(m)) > 0)
for (i = 0; i < n; i++) {
@ -1364,7 +1354,7 @@ static void fixup_date(List *headers, Octstr *hname)
break;
q = p + (strlen(p) - 1);
while (isspace(*q) && q > p)
*q-- = 0;
*q-- = 0;
http_header_add(headers, octstr_get_cstr(hname), p);
octstr_destroy(s);
@ -1787,8 +1777,7 @@ int mms_replace_header_values(MmsMsg *msg, char *hname, List *value)
Octstr *mms_get_header_value(MmsMsg *msg, Octstr *header)
{
gw_assert(msg);
return http_header_value(msg->headers, header);
return http_header_value(msg->headers, header);
}
@ -1816,7 +1805,6 @@ List *mms_get_header_values(MmsMsg *msg, Octstr *header)
int mms_convert_readrec2readorig(MmsMsg *msg)
{
Octstr *s;
gw_assert(msg);
@ -1830,10 +1818,8 @@ int mms_convert_readrec2readorig(MmsMsg *msg)
time_t t = time(NULL);
s = date_format_http(t);
mms_replace_header_value(msg, "Date", octstr_get_cstr(s));
}
if (s)
octstr_destroy(s);
}
octstr_destroy(s);
return 0;
}
@ -1856,10 +1842,8 @@ MmsMsg *mms_storeconf(char *errstr, char *transid, Octstr *msgloc, int isupload,
m->message_type = MMS_MSGTYPE_MBOX_UPLOAD_CONF;
http_header_add(m->headers, "X-Mms-Message-Type", "m-mbox-upload-conf");
}
http_header_add(m->headers, "X-Mms-Transaction-ID", transid);
http_header_add(m->headers, "X-Mms-MMS-Version", "1.2"); /* ignore menc for now. */
http_header_add(m->headers, "X-Mms-Transaction-ID", transid);
http_header_add(m->headers, "X-Mms-MMS-Version", "1.2"); /* ignore menc for now. */
http_header_add(m->headers, "X-Mms-Store-Status", errstr);
if (msgloc)
@ -2035,10 +2019,7 @@ MmsMsg *mms_viewconf(char *transid,
} else
http_header_add(m->headers, "X-Mms-Response-Status", "Ok");
msize = mms_msgsize(m);
n = gwlist_len(msgrefs);
msgcount = 0;

View File

@ -1236,7 +1236,7 @@ static struct {
{"application/java-archive", "jar"},
{"video/3gpp", "3gp2"},
{"video/3gpp", "3gp"},
{"video/3gpp2", "3g2"},
{NULL, NULL}
};