问题描述
我期待在Web服务器模块在整合多部分表单数据解析,这样我可以从解析多部分数据本身减轻后端的Web应用程序(通常是动态语言编写)。多部分语法(RFC 2046)看起来不平凡的,如果我用手工实现它有很多事情都可能出错。有没有已经写在C或C ++的好,重量轻的multipart / form-data的解析器?我在寻找一个与的没有的外部比C或C ++标准库等的依赖关系。我不需要的电子邮件附件处理或缓冲I / O类或便携性运行或什么的,只是多部分/格式数据的解析。
I'm looking at integrating multipart form-data parsing in a web server module so that I can relieve backend web applications (often written in dynamic languages) from parsing the multipart data themselves. The multipart grammar (RFC 2046) looks non-trivial and if I implement it by hand a lot of things can go wrong. Is there already a good, lightweight multipart/form-data parser written in C or C++? I'm looking for one with no external dependencies other than the C or C++ standard library. I don't need email attachment handling or buffered I/O classes or a portability runtime or whatever, just multipart/form-data parsing.
的事情,我已经考虑:
- GMime - 取决于能说会道,所以就没去
- 力霸preQ - 过大,依赖于APR,记录不好,没有单元测试
我也看着写有Ragel解析器,但我无法弄清楚如何做到这一点,因为语法不是一成不变的:边界可以任意更改
I've also looked at writing a parser with Ragel, but I can't figure out how to do it because the grammar is not static: the boundary can change arbitrarily.
推荐答案
我知道这个问题是几年现在老了,但我需要同样的,结束了使用此:
I know this question is a couple of years old now, but I needed the same and ended up using this:
https://github.com/iafonov/multipart-parser-c
这篇关于是否有C或C ++一个轻量级的multipart / form-data的解析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!