1
0
Fork 0

Removal of code work-arounds for Kannel MIME bugs (now fixed)

This commit is contained in:
bagyenda 2006-11-25 11:53:40 +00:00
parent 00c7e34515
commit 65a82a7175
9 changed files with 37 additions and 50 deletions

View File

@ -1,3 +1,6 @@
2006-11-25 Paul A. Bagyenda <bagyenda@dsmagic.com>
* Minor changes to remove work-arounds for Kannel GWLIB bugs (now fixed
in CVS)
2006-11-18 Paul A. Bagyenda <bagyenda@dsmagic.com>
* Minor fix for quoting of content type parameters in MIME & HTTP messages
(Message-ID: <c51a177f0611132344s16aaaa3bo46944ce97abfd535@mail.gmail.com>)

View File

@ -373,7 +373,7 @@ explains the steps required to install the gateway. <strong>If you are
In brief, to install Mbuni, you need to:
<ul>
<li>Download and install required packages (such as libXML, libiconv)
<li>Download and install Kannel v1.4.1
<li>Download and install Kannel CVS (pre-1.4.2)
<li>Download and install Mbuni
<li>Download, patch and install the AMR encoder/decoder
<li>Download and install additional <a href="#required">requried</a> packages
@ -390,16 +390,16 @@ href="http://www.mbuni.org/downloads.shtml">download area</a> of the website
<H4><!--TableOfContentsAnchor:Begin--><A NAME="Section_.1.2.1"></A><!--TableOfContentsAnchor:End-->Installing Kannel</H4>
<p>In order to compile the software, you
will first need to download and install Kannel v1.4.1 from <a
href="http://www.kannel.org/download/1.4.1/gateway-1.4.1.tar.bz2">kannel.org</a>:</p>
will first need to download and install Kannel CVS from <a
href="http://kannel.org/download/kannel-snapshot.tar.gz">kannel.org</a>:</p>
<p>Unpack the kannel
source files using a command like:</p>
<p><tt>bzip2 -cd
gateway-1.4.1.tar.bz2 | tar xf -</tt></p>
<p><tt>tar xvf
kannel-snapshot.tar.gz</tt></p>
@ -408,7 +408,7 @@ compile and install Kannel normally:</p>
<p>
<tt>./configure</tt>
<tt>cd kannel-snapshot; ./configure</tt>
<br>
<tt>make install</tt>
</p>

View File

@ -274,7 +274,7 @@ MSoapMsg_t *mm7_parse_soap(List *headers, Octstr *body)
char *loc = octstr_get_cstr(cloc) + 4; /* skip 'cid:' part. */
for (i = 0, n = mime_entity_num_parts(mime); i<n; i++) {
MIMEEntity *x = mime_entity_get_part(mime, i);
List *headers = _x_mime_entity_headers(x);
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);
@ -594,7 +594,7 @@ int mm7_soapmsg_to_httpmsg(MSoapMsg_t *m, List **hdrs, Octstr **body)
http_header_add(hh, "Content", octstr_get_cstr(cloc));
/* Replace content location in msg part. */
hx = _x_mime_entity_headers(c);
hx = mime_entity_headers(c);
http_header_remove_all(hx, "Content-ID");
http_header_add(hx, "Content-ID", octstr_get_cstr(cloc_str));
mime_replace_headers(c, hx);
@ -638,7 +638,7 @@ int mm7_soapmsg_to_httpmsg(MSoapMsg_t *m, List **hdrs, Octstr **body)
http_destroy_headers(headers);
*body = mime_entity_body(mime);
*hdrs = _x_mime_entity_headers(mime);
*hdrs = mime_entity_headers(mime);
mime_entity_destroy(mime);
@ -974,7 +974,7 @@ MSoapMsg_t *mm7_mmsmsg_to_soap(MmsMsg *msg, Octstr *from, List *xto,
}
/* Should we bother to strip message part of headers??? */
headers = _x_mime_entity_headers(m->msg);
headers = mime_entity_headers(m->msg);
http_header_remove_all(headers, "Subject");
http_header_remove_all(headers, "X-Mms-Message-Type");
http_header_remove_all(headers, "X-Mms-Message-Version");

View File

@ -178,7 +178,7 @@ static int encode_multipart(Octstr *os, List *body)
while (i<n) {
Octstr *mhdr, *mbody = octstr_create("");
MIMEEntity *x = gwlist_get(body, i);
List *headers = _x_mime_entity_headers(x);
List *headers = mime_entity_headers(x);
Octstr *s;
strip_boundary_element(headers,NULL);
@ -1146,7 +1146,7 @@ static void _x_mime_entity_dump(MIMEEntity *x, int level, int headers_only)
ism = ((m = mime_entity_num_parts(x)) > 0);
debug("part.dump", 0, "%sMultipart -> ", ism ? "" : "Not ");
h = _x_mime_entity_headers(x);
h = mime_entity_headers(x);
strip_boundary_element(h,NULL);
http_header_dump(h);
http_destroy_headers(h);
@ -1214,7 +1214,7 @@ static void convert_mime_msg(MIMEEntity *m)
int i, n;
Octstr *content_type, *params;
char *s = NULL;
List *h = _x_mime_entity_headers(m);
List *h = mime_entity_headers(m);
get_content_type(h, &content_type, &params);
@ -1265,7 +1265,7 @@ static void unconvert_mime_msg(MIMEEntity *m)
int i, n;
Octstr *content_type, *params;
char *s = NULL;
List *h = _x_mime_entity_headers(m);
List *h = mime_entity_headers(m);
get_content_type(h, &content_type, &params);
@ -1344,7 +1344,7 @@ MmsMsg *mms_frommime(MIMEEntity *mime)
unpack_mimeheaders(mx);
unbase64_mimeparts(mx);
m->headers = _x_mime_entity_headers(mx);
m->headers = mime_entity_headers(mx);
if (n > 0) {
int i;
m->ismultipart = 1;
@ -2007,7 +2007,7 @@ MmsMsg *mms_viewconf(char *transid,
ms = mms_tobinary(mm);
if (octstr_len(ms) + msize <= maxsize) {
MIMEEntity *mtmp = mime_entity_create();
List *h = _x_mime_entity_headers(mtmp);
List *h = mime_entity_headers(mtmp);
http_header_add(h, "Content-Type",
"application/vnd.wap.mms-message");

View File

@ -591,7 +591,7 @@ static void init_format_table(void)
/* Removes an object by making it text/plain. For now not configurable. */
static void remove_object(MIMEEntity *m, Octstr *ctype)
{
List *h = _x_mime_entity_headers(m);
List *h = mime_entity_headers(m);
Octstr *s = octstr_format("Unsupported object (content type %S) removed", ctype);
http_header_remove_all(h, "Content-Type");
@ -652,7 +652,7 @@ static void replace_body(MIMEEntity *msg, Octstr *newbody, List *params_h,
{
Octstr *part_name;
Octstr *new_partname = NULL;
List *h = _x_mime_entity_headers(msg);
List *h = mime_entity_headers(msg);
mime_entity_set_body(msg, newbody); /* Replace the body. */
octstr_destroy(newbody);
@ -704,7 +704,7 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
tmpf[0] = tmpf2[0] = 0; /* Clear .*/
/* Get the content type, hash it. */
h = _x_mime_entity_headers(msg);
h = mime_entity_headers(msg);
get_content_type(h, &content_type, &params);
params_h = get_value_parameters(params);
@ -720,7 +720,7 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
for (i = 0; i<n; i++) {
MIMEEntity *x = mime_entity_get_part(msg,i);
List *hx = _x_mime_entity_headers(x);
List *hx = mime_entity_headers(x);
Octstr *cid = _x_get_content_id(hx);
int sup;
@ -1049,7 +1049,7 @@ static int format_special(MIMEEntity *m,
List *headers;
tmpf[0] = 0;
headers = _x_mime_entity_headers(m);
headers = mime_entity_headers(m);
get_content_type(headers, &content_type, &params);
params_h = get_value_parameters(params);
@ -1061,7 +1061,7 @@ static int format_special(MIMEEntity *m,
for (i = 0; i<n; i++) {/* format sub-parts, find presentation part too */
MIMEEntity *x = mime_entity_get_part(m,i);
Octstr *ctype = NULL, *charset = NULL;
List *hx = _x_mime_entity_headers(x);
List *hx = mime_entity_headers(x);
Octstr *cid = _x_get_content_id(hx);
http_header_get_content_type(hx, &ctype, &charset);
@ -1108,7 +1108,7 @@ static int format_special(MIMEEntity *m,
if (i == presindex) continue; /* Skip the presentation param. */
hx = _x_mime_entity_headers(x);
hx = mime_entity_headers(x);
cid = _x_get_content_id(hx);
if (cid == NULL) {
@ -1186,7 +1186,7 @@ static int format_special(MIMEEntity *m,
pres = mime_entity_get_part(m,presindex);
presbody = mime_entity_body(pres);
h = _x_mime_entity_headers(pres);
h = mime_entity_headers(pres);
http_header_remove_all(h, "Content-Type");
http_header_add(h, "Content-Type", "multipart/alternative");

View File

@ -330,7 +330,7 @@ void unpack_mimeheaders(MIMEEntity *mm)
{
int i, n;
List *h = http_create_empty_headers();
List *headers = _x_mime_entity_headers(mm);
List *headers = mime_entity_headers(mm);
for (i = 0, n = gwlist_len(headers); i<n; i++) {
@ -390,7 +390,7 @@ void unbase64_mimeparts(MIMEEntity *m)
mime_entity_destroy(x);
}
else { /* A non-multipart message .*/
List *headers = _x_mime_entity_headers(m);
List *headers = mime_entity_headers(m);
Octstr *ctype = http_header_value(headers, octstr_imm("Content-Type"));
Octstr *te = http_header_value(headers, octstr_imm("Content-Transfer-Encoding"));
@ -433,7 +433,7 @@ void base64_mimeparts(MIMEEntity *m)
mime_entity_destroy(x);
}
else { /* A non-multipart message .*/
List *headers = _x_mime_entity_headers(m);
List *headers = mime_entity_headers(m);
Octstr *ctype = http_header_value(headers, octstr_imm("Content-Type"));
Octstr *te = http_header_value(headers, octstr_imm("Content-Transfer-Encoding"));
Octstr *body = mime_entity_body(m);
@ -680,7 +680,7 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
http_header_add(newhdrs, "MIME-Version", "1.0");
headers = _x_mime_entity_headers(m);
headers = mime_entity_headers(m);
http_header_combine(headers, newhdrs);
mime_replace_headers(m, headers);
@ -1023,7 +1023,7 @@ int parse_cgivars(List *request_headers, Octstr *request_body,
/* Go through body parts, pick out what we need. */
for (i = 0, n = mime_entity_num_parts(m); i < n; i++) {
MIMEEntity *mp = mime_entity_get_part(m, i);
List *headers = _x_mime_entity_headers(mp);
List *headers = mime_entity_headers(mp);
Octstr *body = mime_entity_body(mp);
Octstr *ct = http_header_value(headers,
octstr_imm("Content-Type"));
@ -1075,19 +1075,6 @@ done:
return ret;
}
/* We need this because of boundary element adding bug in gwlib/mime.c */
List *_x_mime_entity_headers(MIMEEntity *m)
{
List *h = mime_entity_headers(m);
http_header_remove_all(h, "MIME-Version");
/* also remove boundary element -- it was added erroneously */
if (mime_entity_num_parts(m) == 0)
strip_boundary_element(h,NULL);
mime_replace_headers(m, h);
return h;
}
/* get content-ID header, fix: WAP decoder may leave " at beginning */
Octstr *_x_get_content_id(List *headers)
{

View File

@ -149,9 +149,6 @@ void escape_shell_chars(Octstr *str);
int parse_cgivars(List *request_headers, Octstr *request_body,
List **cgivars, List **cgivar_ctypes);
/* Helper function: The gwlib func adds an additional MIME-Version header which is not ideal! */
List *_x_mime_entity_headers(MIMEEntity *m);
/* get content-ID header, fix: WAP decoder may leave " at beginning */
Octstr *_x_get_content_id(List *headers);

View File

@ -50,7 +50,7 @@ static MIMEEntity *find_textpart(MIMEEntity *m)
if (!m) return NULL;
headers = _x_mime_entity_headers(m);
headers = mime_entity_headers(m);
get_content_type(headers, &ctype, &params);
http_destroy_headers(headers);
@ -168,7 +168,7 @@ static void add_all_matching_parts(MIMEEntity *plist, MmsServiceUrlParam *pm,
Octstr *data = NULL, *ctype = NULL, *xctype = NULL, *params = NULL;
Octstr *s;
headers = _x_mime_entity_headers(me);
headers = mime_entity_headers(me);
if (pm->type == WHOLE_BINARY && lev == 0) {
data = mms_tobinary(msg);
ctype = octstr_imm("application/vnd.wap.mms-message");
@ -347,7 +347,7 @@ static int fetch_serviceurl(MmsEnvelope *e,
}
body = mime_entity_body(x);
rh = _x_mime_entity_headers(x);
rh = mime_entity_headers(x);
mime_entity_destroy(x);
@ -1044,7 +1044,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
mmc = e->fromproxy;
/* Add some nice headers. */
xheaders = _x_mime_entity_headers(me);
xheaders = mime_entity_headers(me);
http_header_add(xheaders, "From", octstr_get_cstr(from));
for (i = 0, n = gwlist_len(xto); i < n; i++) {

View File

@ -116,7 +116,7 @@ int main(int argc, char *argv[])
unpack_mimeheaders(mm);
/* Delete some headers... */
headers = _x_mime_entity_headers(mm);
headers = mime_entity_headers(mm);
http_header_remove_all(headers, "Received");
http_header_remove_all(headers, "X-MimeOLE");
http_header_remove_all(headers, "X-Mailer");