1
0
Fork 0

added application/vnd.mbuni.url-list

This commit is contained in:
bagyenda 2008-07-15 22:36:12 +00:00
parent b99cbd96fa
commit 590444539c
7 changed files with 86 additions and 15 deletions

View File

@ -1,3 +1,5 @@
2008-07-15 P. A. Bagyenda <bagyenda@dsmagic.com>
* Added file type application/vnd.mbuni.url-list for basic multipart/mixed type
2008-07-10 P. A. Bagyenda <bagyenda@dsmagic.com>
* Fixed minimum size of pgsql connection pool
* Fix for shutdown procedure

View File

@ -24,7 +24,7 @@ AC_MSG_RESULT([$M_VERSION])
AC_CONFIG_SRCDIR([mmlib/mms_util.c])
AC_CONFIG_AUX_DIR(autotools)
AM_INIT_AUTOMAKE([mbuni],[cvs])
AM_INIT_AUTOMAKE([mbuni],[$M_VERSION])
AC_CONFIG_HEADERS([mbuni-config.h])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST

View File

@ -135,7 +135,7 @@ RANLIB = ranlib
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
VERSION = cvs
VERSION = 1.4.0
ac_ct_CC = gcc
ac_ct_CXX = g++
ac_ct_F77 =

View File

@ -1345,12 +1345,15 @@ static struct {
{"audio/midi", "mid"},
{"audio/sp-midi", "mid"},
{"application/smil", "smil"},
{"application/smil", "smi"},
{"application/vnd.wap.mms-message", "mms"},
{"application/java-archive", "jar"},
{"video/3gpp", "3gp2"},
{"video/3gpp", "3gp"},
{"video/3gpp2", "3g2"},
{"audio/vnd.qcelp", "qcp"},
{MBUNI_MULTIPART_TYPE, "urls"}, /* mbuni url list type. */
{NULL, NULL}
};
@ -1895,3 +1898,60 @@ void add_multipart_form_field(MIMEEntity *multipart, char *field_name, char *cty
octstr_destroy(cd);
}
MIMEEntity *multipart_from_urls(List *url_list)
{
int i, n;
List *rh = http_create_empty_headers();
MIMEEntity *m = mime_entity_create();
http_header_add(rh, "User-Agent", MM_NAME "/" VERSION);
for (i = 0, n = gwlist_len(url_list); i<n; i++) {
List *rph = NULL;
Octstr *rbody = NULL;
Octstr *url = gwlist_get(url_list, i);
if (mms_url_fetch_content(HTTP_METHOD_GET,
url, rh, NULL, &rph, &rbody) == HTTP_OK) {
List *mh = http_create_empty_headers();
Octstr *x;
MIMEEntity *mx;
if ((x = http_header_value(rph, octstr_imm("Content-Type"))) != NULL) {
http_header_add(mh, "Content-Type", octstr_get_cstr(x));
octstr_destroy(x);
} else
http_header_add(mh, "Content-Type", "application/content-stream");
if ((x = http_header_value(rph, octstr_imm("Content-ID"))) != NULL) {
http_header_add(mh, "Content-ID", octstr_get_cstr(x));
octstr_destroy(x);
}
if ((x = http_header_value(rph, octstr_imm("Content-Location"))) != NULL) {
http_header_add(mh, "Content-Location", octstr_get_cstr(x));
octstr_destroy(x);
}
mx = mime_http_to_entity(mh, rbody);
mime_entity_add_part(m, mx);
http_destroy_headers(mh);
mime_entity_destroy(mx);
} else
error(0, "multipart_from_urls: Failed to load URL content for URL [%s]",
octstr_get_cstr(url));
octstr_destroy(rbody);
http_destroy_headers(rph);
}
http_destroy_headers(rh);
/* Now change the content type on this baby. */
rh = http_create_empty_headers();
http_header_add(rh, "Content-Type", "multipart/mixed");
mime_replace_headers(m, rh);
http_destroy_headers(rh);
return m;
}

View File

@ -53,6 +53,7 @@
#define _TT "0123456789abcdefghijklmnopqrstuvwxyz"
#define _TTSIZE (-1 + sizeof _TT)
#define MBUNI_MULTIPART_TYPE "application/vnd.vnd.mbuni.url-list"
/* Global variables and shared code used by all modules. */
@ -219,6 +220,9 @@ void add_multipart_form_field(MIMEEntity *multipart, char *field_name,
char *ctype, char *content_loc,
Octstr *data);
/* Build a multipart message from a list of URLs. Fetch each one and add. Result is a multipart/mixed message. */
MIMEEntity *multipart_from_urls(List *url_list);
/* load a shared object, then load a symbol from it. */
void *_mms_load_module(mCfgGrp *grp, char *config_key, char *symbolname,
void *shell_builtin);

View File

@ -4,4 +4,4 @@ bin_PROGRAMS = mmsbox
mmsbox_SOURCES = mmsbox.c mmsbox_cfg.c dlr.c bearerbox.c mmsbox_resolve.c mmsbox_resolve_shell.c
mmsbox_LDADD = $(libmms)
EXTRA_DIST = mmsbox_cfg.h mmsbox.h mmsbox_mt_filter.h mmsbox_resolve.h mmsbox_mmsc.h
EXTRA_DIST = mmsbox_cfg.h mmsbox.h mmsbox_mt_filter.h mmsbox_resolve_shell.h mmsbox_resolve.h mmsbox_mmsc.h

View File

@ -306,17 +306,13 @@ done:
octstr_destroy(cd);
}
if (xctype)
octstr_destroy(xctype);
if (params)
octstr_destroy(params);
if (ctype)
octstr_destroy(ctype);
if (data)
octstr_destroy(data);
if (headers)
http_destroy_headers(headers);
octstr_destroy(xctype);
octstr_destroy(params);
octstr_destroy(ctype);
octstr_destroy(data);
http_destroy_headers(headers);
}
enum _xurltype {FILE_TYPE, URL_TYPE};
@ -952,9 +948,18 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
else if (octstr_case_search(ctype, octstr_imm("multipart/"), 0) == 0) { /* treat it differently. */
MIMEEntity *mime = mime_http_to_entity(reply_headers, data);
if (mime) {
m = mms_frommime(mime);
mime_entity_destroy(mime);
mime_entity_destroy(me);
me = mime;
}
} else if (octstr_case_search(ctype, octstr_imm(MBUNI_MULTIPART_TYPE), 0) == 0) { /* Mbuni multipart.*/
List *l = octstr_split_words(data);
MIMEEntity *mime = multipart_from_urls(l);
if (mime) {
mime_entity_destroy(me);
me = mime;
}
gwlist_destroy(l, (void *)octstr_destroy);
} else if (octstr_case_search(ctype, octstr_imm("application/smil"), 0) == 0) {
xmlDocPtr smil;
xmlChar *buf = NULL;