1
0
Fork 0

fix: correct quoting of content-type parameters in mime message

This commit is contained in:
bagyenda 2006-11-18 06:20:05 +00:00
parent 8ece099c13
commit 00c7e34515
4 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,6 @@
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>)
2006-11-11 Paul A. Bagyenda <bagyenda@dsmagic.com>
* Minor fix in MM7 module (replycharging attribute),
thanks to Michel Martin <michel.marti@objectxp.com>

View File

@ -1231,8 +1231,16 @@ static void convert_mime_msg(MIMEEntity *m)
octstr_destroy(content_type);
}
if (s) {
Octstr *value = (params && octstr_len(params) > 0) ?
octstr_format("%s; %S", s, params) : octstr_create(s);
Octstr *value;
if (params && octstr_len(params) > 0) {
List *ph = get_value_parameters(params); /* unpack then re-pack them with proper quoting for mime.*/
Octstr *ps = make_value_parameters(ph);
value = octstr_format("%s; %S", s, params);
octstr_destroy(ps);
http_destroy_headers(ph);
} else
value = octstr_create(s);
http_header_remove_all(h, "Content-Type");
http_header_add(h, "Content-Type", octstr_get_cstr(value));

View File

@ -278,6 +278,15 @@ int get_content_type(List *hdrs, Octstr **type, Octstr **params)
return 0;
}
static int is_mime_special_char(int ch)
{
const char *x = "=;<>[]?()@:\\/,";
char *p;
for (p = (char *)x; *p; p++)
if (ch == *p)
return 1;
return 0;
}
static int needs_quotes(Octstr *s)
{
int i, n;
@ -286,7 +295,7 @@ static int needs_quotes(Octstr *s)
for (i = 0, n = octstr_len(s); i<n; i++) {
int ch = octstr_get_char(s,i);
if (isspace(ch) || ch == '=' || ch == ';' || ch == '<' || ch == '>')
if (isspace(ch) || is_mime_special_char(ch))
return 1;
}
return 0;

View File

@ -235,9 +235,9 @@ static void mm7soap_receive(MmsHTTPClientInfo *h)
http_close_client(h->client);
debug("mmsbox.mm7sendinterface", 0,
" --> leaving mm7dispatch interface, mresp=%s, body=%s <-- ",
" --> leaving mm7dispatch interface, mresp=%s, body=%s, mm7_status=%d <-- ",
mresp ? "ok" : "(null)",
reply_body ? "ok" : "(null)");
reply_body ? "ok" : "(null)", status);
if (from)