http - 无边界的多部分/表单数据

标签 http multipartform-data boundary

多部分/表单数据请求是否无边界有效?根据规范,当有超过 1 个部分时,使用边界将它们分开(并且这个边界不应该是 body 的一部分)。我有一个请求,其中有一个主体作为原始内容或文件,并且在我们传递的内容类型中 "multipart/form-data"。这种要求真的有效吗?

最佳答案

我认为没有边界的multipart/form-data请求无效

根据 RFC7231 , 只有 1 部分的请求仍然是有效的 multipart MIME 类型并且应该遵循 multipart MIME 规则:

MIME provides for a number of "multipart" types -- encapsulations of one or more representations within a single message body. All multipart types share a common syntax ... and include a boundary parameter as part of the media type value.

根据 RFC2046 ,“边界”是必需的和强制性的:

The Content-Type field for multipart entities requires one parameter, "boundary".

...

The only mandatory global parameter for the "multipart" media type is the boundary parameter

关于http - 无边界的多部分/表单数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43932900/

相关文章:

php - 为什么 redirect() 不允许我完成函数调用?

java - 在 'handled' 相同表单的文本字段后,文件未上传

ios - 如何使用 Swift 进行多部分/表单数据发布请求?

python - 无法使用正则表达式使用单词或空格边界提取所有单词

http - Netcat 服务器连接被拒绝

angular - 当 url 不可用时如何设置后备 (assets/i18n/en.json) (ngx-translate/http-loader)

python - 使用 Python 请求下载 PDF 时访问被拒绝

spring-mvc - 如何从 spring mvc multipartfile 进入 zipinputstream

split - SQOOP 中 --split-by 和 --boundary-query 有什么区别?

c++ - 多边形内部或边界内的点