[PATCH] WSP Content-ID header encoding fix
"P. A. Bagyenda" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Attached is a small patch to wsp_headers.[ch] to fix the encoding of the Content-ID header. According to WAP-203-WSP (Sec. 8.4.2.67) the content-id value should be encoded as a quoted string. I've come across one or two devices that insist on this -- as they should. This kills MMS parsing for the devices. Votes please. P.
wsp_headers.diff
(application/octet-stream, 1.9 KB)
Index: wap/wsp_headers.c
===================================================================
RCS file: /home/cvs/gateway/wap/wsp_headers.c,v
retrieving revision 1.27
diff -u -r1.27 wsp_headers.c
--- wap/wsp_headers.c 5 Mar 2008 08:01:07 -0000 1.27
+++ wap/wsp_headers.c 30 May 2008 12:04:28 -0000
@@ -1487,7 +1487,7 @@
{ WSP_HEADER_X_WAP_CONTENT_URI, pack_uri, 0},
{ WSP_HEADER_X_WAP_INITIATOR_URI, pack_uri, 0},
{ WSP_HEADER_X_WAP_APPLICATION_ID, wsp_pack_integer_string, 0},
- { WSP_HEADER_CONTENT_ID, wsp_pack_text, 0},
+ { WSP_HEADER_CONTENT_ID, wsp_pack_quoted_text, 0},
{ WSP_HEADER_ENCODING_VERSION, wsp_pack_version_value, 0 }
// DAVI { WSP_HEADER_SET_COOKIE, pack_version_value, 0 }
};
@@ -1623,6 +1623,15 @@
return 0;
}
+/* Pack a string as quoted-text WAP WSP 203, Section 8.4.2.1 */
+int wsp_pack_quoted_text(Octstr *packed, Octstr *text)
+{
+ octstr_append_char(packed, '"');
+ octstr_append(packed,text);
+ octstr_append_char(packed,0);
+ return 0;
+}
+
/* Pack text as Quoted-string if it starts with a " character.
* Pack it as Text-string otherwise. */
static void pack_quoted_string(Octstr *packed, Octstr *text)
Index: wap/wsp_headers.h
===================================================================
RCS file: /home/cvs/gateway/wap/wsp_headers.h,v
retrieving revision 1.12
diff -u -r1.12 wsp_headers.h
--- wap/wsp_headers.h 9 Jan 2008 20:06:59 -0000 1.12
+++ wap/wsp_headers.h 30 May 2008 12:04:28 -0000
@@ -141,6 +141,7 @@
int wsp_pack_date(Octstr *packet, Octstr *value);
int wsp_pack_retry_after(Octstr *packet, Octstr *value);
int wsp_pack_text(Octstr *packet, Octstr *value);
+int wsp_pack_quoted_text(Octstr *packed, Octstr *text);
int wsp_pack_integer_string(Octstr *packet, Octstr *value);
int wsp_pack_version_value(Octstr *packet, Octstr *value);
int wsp_pack_constrained_value(Octstr *packed, Octstr *text, long value);