multipart/mixed 支持 Netty

multipart/mixed support in Netty

通过浏览源代码和玩一些玩具示例,我得出结论,Netty 目前(从 5.0.0 alpha2 开始)仅支持 multipart/form-data,但不支持 multipart/mixed,至少与 RFC1342 (sec. 7.2) 中指定的不同。不过 multipart/form-data 中的某个部分似乎支持混合。

真的是这样还​​是我遗漏了什么?

因为我得到了同样的问题,所以我 post 在这里开始回答...

However, the current implementation seems to have 2 limitations:

1) it supports only multipart/form-data. I would like to also be able to use multipart/mixed, which is very similar on the wire (see http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html ). I think that the encoder/decoder could be extended to understand multipart/mixed and still create the same kinds of HttpDatas.

是的,当前编解码器集中在multipart/form-data。我将有可能扩展或提出一个新的(可能基于它)来启用 multipart/mixed 的支持。 当前的编解码器是根据用户需求制作的(一开始是我的,其他人在后面)。由于还没有人请求支持 multipart/mixed,它没有编码,内部 multipart/mixed 代码除外。 引用是RFC1867.

由于 Netty 热爱贡献,非常欢迎您提出您的建议 ;-)

2) it seems that is it only possible to use efficient HttpDatas like FileUpload if you are in multipart/form-data. I would like to be able to add a FileUpload to the request, and by this way make the contents of the file be the body of the request, without making it a multipart request. I think this could be done by extending the Standard Post Encoder to understand FileUploads.

这可能有点复杂,因为它必须在没有 multipart 的情况下完成,multipart 当前包含 FileUpload class。

也许一个好的方向是切换到 ChunkFile 或 ChunkNioFile 并将其与 "your" HttpCodec 或在您的 "HttpHandler" 中进行正文请求时结合使用,以便通过块文件.

希望这能帮助您朝着正确的方向前进...