1
0
Fork 0

minor fix in VAS GW -- better file extension to content ID

This commit is contained in:
bagyenda 2007-07-26 18:42:19 +00:00
parent b3da1b4ead
commit f7da8933d8
6 changed files with 31 additions and 10 deletions

View File

@ -5,7 +5,7 @@
2007-06-21 P. A. Bagyenda <bagyenda@dsmagic.com>
* Better configurability of MM7/SOAP namespace URI and MM7 version.
2007-06-12 P. A. Bagyenda <bagyenda@dsmagic.com>
* Improved DLR reporting over MM4 interface - set receipient as from address
* Improved DLR reporting over MM4 interface - set recipient as from address
2007-05-08 P. A. Bagyenda <bagyenda@dsmagic.com>
* Improved MIME to MMS conversion conversion
2007-05-05 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -1,6 +1,6 @@
dnl Mbuni - Open Source MMS Gateway
dnl
dnl Copyright (C) 2003 - 2006, Digital Solutions Ltd. - http://www.dsmagic.com
dnl Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com
dnl
dnl Paul Bagyenda <bagyenda@dsmagic.com>
dnl
@ -279,7 +279,7 @@ cat<<X
License:
Mbuni (version $M_VERSION) - Open Source MMS Gateway - http://www.mbuni.org/
Copyright (C) 2003 - 2006, Digital Solutions Ltd. - http://www.dsmagic.com
Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com
This program is free software, distributed under the terms of
the GNU General Public License, with a few exceptions granted (see LICENSE)

View File

@ -1591,7 +1591,8 @@ Boolean
file). This is useful if say you want to implement custom
filtering/transformation of content (e.g. DRM wrappers around
selected content). Note that only elements
referenced within the returned SMIL are filtered. See
referenced by URL/file name (e.g. within the returned SMIL or if fetched by
the send-mms interface via URL) are filtered. See
<tt>mmsbox_mt_filter.h</tt> for details. Also see
<tt>mm7-mt-filter-params</tt> config variable in the <a href="#mmsc_vasp">VAS specific
config section</a>.

View File

@ -1253,7 +1253,7 @@ Octstr *filename2content_type(char *fname)
return octstr_imm("application/octet-stream");
}
char *content_type2file_ext(Octstr *ctype)
static char *content_type2file_ext(Octstr *ctype)
{
int i;
for (i = 0; exts[i].file_ext; i++)
@ -1263,6 +1263,26 @@ char *content_type2file_ext(Octstr *ctype)
return "dat";
}
char *make_file_ext(Octstr *url, Octstr *ctype, char fext[5])
{
fext[0] = 0;
if (url) {
HTTPURLParse *h = parse_url(url);
char *s, *p;
if (!h)
goto done;
s = h->path ? octstr_get_cstr(h->path) : "";
if ((p = strrchr(s, '.')) != NULL)
strncpy(fext, p+1, 4); /* max length of 4. */
http_urlparse_destroy(h);
if (fext[0]) return fext;
}
done:
return content_type2file_ext(ctype);
}
static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *request_headers,
Octstr *body, Octstr *auth_hdr, List **reply_headers, Octstr **reply_body);

View File

@ -189,8 +189,8 @@ int mms_is_token(Octstr *token);
/* try to guess content type from file name extension. */
Octstr *filename2content_type(char *fname);
/* try to give a good extension name based on the content type. */
char *content_type2file_ext(Octstr *ctype);
/* try to give a good extension name based on the url or content type. */
char *make_file_ext(Octstr *url, Octstr *ctype, char fext[5]);
#define MAXQTRIES 100
#define BACKOFF_FACTOR 5*60 /* In seconds */

View File

@ -734,7 +734,7 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url,
}
if (ctype && body) { /* If we got it, put it in. */
char *fext = content_type2file_ext(ctype);
char _fext[5] = {0}, *fext = make_file_ext(curl, ctype, _fext);
Octstr *attr = octstr_format("cid:%06d.%s", ++cntr,fext);
char *p = octstr_get_cstr(attr) + 4;
Octstr *cid_header_val = octstr_format("<%s>", p);
@ -953,9 +953,9 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
} else { /* all others, make the message as-is and hope for the best! */
List *xh = http_create_empty_headers();
if (mt_multipart) { /* if its going to be multi-part, add some nice headers. */
if (mt_multipart) { /* if it's going to be multi-part, add some headers. */
static int cntr = 0;
char *fext = content_type2file_ext(ctype);
char _fext[5] = {0}, *fext = make_file_ext(msg_url, ctype, _fext);
Octstr *attr = octstr_format("%06d.%s", ++cntr,fext);
Octstr *cid_header_val = octstr_format("<%S>", attr);