diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index da685b8..1795885 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,6 @@ +2006-11-18 Paul A. Bagyenda + * Minor fix for quoting of content type parameters in MIME & HTTP messages + (Message-ID: ) 2006-11-11 Paul A. Bagyenda * Minor fix in MM7 module (replycharging attribute), thanks to Michel Martin diff --git a/mbuni/mmlib/mms_msg.c b/mbuni/mmlib/mms_msg.c index 233f10e..2cd495d 100644 --- a/mbuni/mmlib/mms_msg.c +++ b/mbuni/mmlib/mms_msg.c @@ -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)); diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index 91618f8..a68f049 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -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') + if (isspace(ch) || is_mime_special_char(ch)) return 1; } return 0; diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 2b3c679..7ad2c37 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -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)