GMime多部分内容

时间:2016-11-12 03:12:55

标签: c xml soap

我正在使用gmime库的c版本,并且在解析和提取似乎已经是多部分形式的内容时遇到问题。我认为解析内容就像gmime一样,会弄清楚如何正确构造多部分,以便简单地执行

g_mime_multipart_get_part(mimeMessage, 0)

将返回soap-xml部分。显然我错了,我对mime和gmime库的有限理解正在扼杀我。请协助。提前感谢你。

GMimeStream * mimeStream = g_mime_stream_mem_new_with_buffer(incoming, n);
GMimeParser * mimeParser = g_mime_parser_new_with_stream(mimeStream);
g_object_unref(mimeStream);
GMimeMessage * mimeMessage = g_mime_parser_construct_message(mimeParser);
g_object_unref(mimeParser);

** RAW内容低于*

------=_Part_5896175_1217116888.1478087584633
Content-Type: text/xml

<soap-env:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
...
</soap-env:Envelope>
------=_Part_5896175_1217116888.1478087584633
Content-Type: multipart/related;Start="<smil>";Type="application/smil";
    boundary="----=_Part_5896174_292278572.1478087584547"
Content-ID: /mms/mm7/mm7client

------=_Part_5896174_292278572.1478087584547
Content-Type: application/smil;Name=smil.xml
Content-Transfer-Encoding: 7bit
Content-ID:<smil>
Content-Location:smil.xml

<smil><head><layout><root-layout width="320px" height="480px"/><region id="Text" left="0" top="320" width="320px" height="160px" fit="meet"/></layout></head><body><par dur="0ms"><text src="text_0.txt" region="Text"/></par></body></smil>
------=_Part_5896174_292278572.1478087584547
Content-Type: text/plain;Name=text_0.txt;Charset=utf-8
Content-Transfer-Encoding: 7bit
Content-ID:<text_0>
Content-Location:text_0.txt

Your MMS was read 02 Nov 2016 13:53
------=_Part_5896174_292278572.1478087584547--

------=_Part_5896175_1217116888.1478087584633--

1 个答案:

答案 0 :(得分:0)

GMime无法解析,因为它不完整。如果内容不是以定义边界的Content-Type标头开头,解析器如何知道多方边界是什么?

相关问题