简单C ++ MIME解析器 [英] Simple C++ MIME parser

查看:317
本文介绍了简单C ++ MIME解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要消化从PHP脚本发回的C ++中的多部分响应。任何人都知道一个非常轻量级的MIME解析器可以为我做这个?

I want to digest a multipart response in C++ sent back from a PHP script. Anyone know of a very lightweight MIME parser which can do this for me?

推荐答案

我知道这可能太少,太晚,但我有一个类似的需求。我想要一个MIME解析器,只是做了MIME的编码和解码。为了完整性和Google的能力,我想我应该把我的发现在这里。记住,我对发送和接收邮件不感兴趣,只是编码和解码MIME。以下是我为C ++ MIME研究的图书馆:

I know this may be too little, too late, but I had a similar need. I wanted a mime parser that just did the encoding and decoding of the MIME. For the sake of completeness and for Google-ability I thought I should put my findings here. Keep in mind that I was not interested in send and receiving mail, just encoding and decode MIME. Here are the libraries I researched for C++ MIME:

http://www.vmime.org / - 看起来太多了。包含pop,SMTP,tls,IMAP,可以删除这个。 Posix和Windows。

http://www.vmime.org/ - Looks like too much. Contains pop, SMTP, tls, IMAP, could remove this. Posix and windows.

http://codesink.org/mimetic_mime_library .html - 看起来很有前途。非常好的api阅读和创建消息。与这一个。不太重。必须修复2件事。首先是multipart的代码只是检查字符串multipart,并没有识别multipart / mixed,没有写出的部分。其次,我不得不破解mimeentity编写代码。它只是写出了std :: deque字段,因为这些是字符串,它似乎是这样按字母顺序。这是问题,因为MIME版本必须是第一个字段写出来。所以我固定这个。我还必须添加对Content-Length的支持。

http://codesink.org/mimetic_mime_library.html - looks promising. Very nice api for reading in and creating messages. Went with this one. Not too heavy. Had to "fix" 2 things. First for multipart the code was just check for the string "multipart" and did not recognize "multipart/mixed" and did not write out the parts. Secondly, I had to hack the mimeentity write code. It was just writing out the std::deque Field and since these are strings it seem to be doing so alphabetically. This is problem because the MIME-version has to be the first field written out. So I fixed this. I also had to add support for Content-Length.

http://www.mozilla.org/mailnews/arch/libmime-description.html - 很难找到这个。不得不下载整个包。 mailnews\mime\src

http://www.mozilla.org/mailnews/arch/libmime-description.html - Hard time finding this. Had to download the whole package. mailnews\mime\src

http:// www.example-code.com/vcpp/smime.asp - 没有考虑,因为它没有源代码,并且是Windows特定的。

http://www.example-code.com/vcpp/smime.asp - Didn’t consider because it had no source code and was windows specific.

http://www.scalingweb.com/mime_parser.php - 没有考虑,因为它取决于其他流库作者。

http://www.scalingweb.com/mime_parser.php - Didn’t consider because it depends on other stream library from author.

http:// httpd .apache.org / docs / 2.2 / mod / mod_mime.html - 找不到此C实现。

http://httpd.apache.org/docs/2.2/mod/mod_mime.html - Couldn’t find this C implementation.

我为我的需要选择了Mimetic,不得不增加一些东西。没有我找到的解析器处理可选字段(Content-Length等)非常好。我还需要它来支持多个平台(Windows,Linux等)。

I chose Mimetic for my needs although I had to add a few things to it. None of the parsers I found handled the optional fields (Content-Length, etc..) very well. I also needed it to support multiple platforms (Windows, Linux, etc..)

这篇关于简单C ++ MIME解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆