- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
RFC7233很好很清楚,除了行尾。
我对 multipart/byteranges
响应的 HTTP 响应主体特别感兴趣。我假设每一行都像 HTTP header 一样由 CRLF 终止,但本文档并未明确说明。我完全困惑的是最后一行:--THIS_SEPARATOR_SEPARATES--
。它后跟一个 CRLF 吗?
完整 block :
HTTP/1.1 206 Partial Content
Date: Wed, 15 Nov 1995 06:25:24 GMT
Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
Content-Length: 1741
Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
--THIS_STRING_SEPARATES
Content-Type: application/pdf
Content-Range: bytes 500-999/8000
...the first range...
--THIS_STRING_SEPARATES
Content-Type: application/pdf
Content-Range: bytes 7000-7999/8000
...the second range
--THIS_STRING_SEPARATES--
对不起,我真的找不到它,所以帮助将不胜感激。注意:请不要有直觉,只有 RFC 引用。
最佳答案
如果您更仔细地阅读 RFC 7233,Appendix A指RFC 2046 Section 5.1对于 HTTP 正文中 MIME 数据的实际格式:
When a 206 (Partial Content) response message includes the content ofmultiple ranges, they are transmitted as body parts in a multipartmessage body ([RFC2046], Section 5.1) with the media type of"multipart/byteranges".
RFC 2046 第 5.1 节定义了“多部分”媒体类型的正式定义及其边界的格式化和解析方式。
为了回答您的问题,这里是来自 RFC 2046 的正式语法:
The boundary delimiter MUST occur at the beginning of a line, i.e., following a CRLF, and the initial CRLF is considered to be attached to the boundary delimiter line rather than part of the preceding part. The boundary may be followed by zero or more characters of linear whitespace. It is then terminated by either another CRLF and the header fields for the next part, or by two CRLFs, in which case there are no header fields for the next part. If no Content-Type field is present it is assumed to be "message/rfc822" in a "multipart/digest" and "text/plain" otherwise. NOTE: The CRLF preceding the boundary delimiter line is conceptually attached to the boundary so that it is possible to have a part that does not end with a CRLF (line break). Body parts that must be considered to end with line breaks, therefore, must have two CRLFs preceding the boundary delimiter line, the first of which is part of the preceding body part, and the second of which is part of the encapsulation boundary.
...
The boundary delimiter line following the last body part is a distinguished delimiter that indicates that no further body parts will follow. Such a delimiter line is identical to the previous delimiter lines, with the addition of two more hyphens after the boundary parameter value. --gc0pJq0M:08jU534c0p-- NOTE TO IMPLEMENTORS: Boundary string comparisons must compare the boundary value with the beginning of each candidate line. An exact match of the entire candidate line is not required; it is sufficient that the boundary appear in its entirety following the CRLF.
...
The only mandatory global parameter for the "multipart" media type is the boundary parameter, which consists of 1 to 70 characters from a set of characters known to be very robust through mail gateways, and NOT ending with white space. (If a boundary delimiter line appears to end with white space, the white space must be presumed to have been added by a gateway, and must be deleted.) It is formally specified by the following BNF: boundary := 0*69 bcharsnospace bchars := bcharsnospace / " " bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / "+" / "_" / "," / "-" / "." / "/" / ":" / "=" / "?" Overall, the body of a "multipart" entity may be specified as follows: dash-boundary := "--" boundary ; boundary taken from the value of ; boundary parameter of the ; Content-Type field. multipart-body := [preamble CRLF] dash-boundary transport-padding CRLF body-part *encapsulation close-delimiter transport-padding [CRLF epilogue] transport-padding := *LWSP-char ; Composers MUST NOT generate ; non-zero length transport ; padding, but receivers MUST ; be able to handle padding ; added by message transports. encapsulation := delimiter transport-padding CRLF body-part delimiter := CRLF dash-boundary close-delimiter := delimiter "--" preamble := discard-text epilogue := discard-text discard-text := *(*text CRLF) *text ; May be ignored or discarded. body-part := MIME-part-headers [CRLF *OCTET] ; Lines in a body-part must not start ; with the specified dash-boundary and ; the delimiter must not appear anywhere ; in the body part. Note that the ; semantics of a body-part differ from ; the semantics of a message, as ; described in the text. OCTET := <any 0-255 octet value>
新部分开头的每个定界符都以 CRLF 终止,任何紧接在定界符之前的 CRLF 都被解析为边界的一部分,而不是前一部分的数据。但是,在最终关闭边界的末尾没有 CRLF,除非存在尾声(这在电子邮件中很少使用,而且我从未见过它在 HTTP 中使用,因为无法确定尾声何时结束除非存在有效的 Content-Length
header ,它不应该与 MIME 等自终止内容类型一起使用。
关于HTTP Range 请求 multipart/byteranges - 最后有 CRLF 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33619914/
根据HTML specs : If the contents of a file are submitted with a form, the file input should be identif
我能够找到很多关于 multipart/form-data 的信息,但关于 multipart/related 的信息却不多。在协议(protocol)/请求格式方面,谁能解释一下这两个http规范在
我尝试从项目详细信息页面添加图像。图像添加成功,但是当我尝试在 itemdetails 页面显示图像时,出现异常 org.springframework.web.multipart.Multipart
在 Spring Boot 中,对于分段上传,我看到许多教程站点都建议具有以下属性之一:spring.http.multipart.enabled=false或者spring.servlet.mult
我正在尝试向服务器发送多部分请求,但出现以下异常 HTTP 状态 500 - 请求处理失败;嵌套异常是 org.springframework.web.multipart.MultipartExcep
情况: 从 Node.js(通过 Node 核心 HTTPS 模块)向 spring-boot Java API 提交多部分表单请求。 API 需要两个表单数据元素: “路线” "file" 完全错误
上传到 webapi Controller 时,我仅在某些文件上收到错误。 错误是“MIME 多部分流。MIME 多部分消息不完整” 似乎该错误与某种未良好终止的 POST 数据相关联,但当我使用 f
我有一个有效的解决方案,但似乎很愚蠢,需要它。 这是我的工作解决方案: @PreAuthorize("isAuthenticated()") @ApiOperation(value = "Takes
这个问题已经有答案了: How can I upload files to a server using JSP/Servlet and Ajax? (4 个回答) 已关闭2 年前。 我尝试用java
我尝试通过包含的 CURL 发布 multipart/form-data, A JSON Object Stream object pdf and jpeg file curl -i -X POS
我在表单帖子中遇到了土耳其语字符问题, 我在尝试以下代码时遇到问题, // some input 但是当我尝试这个时它工作正常 // some input 为什么会这样? 最佳答案 在第一个示
我花了几天时间让 Spring Boot Upload 文件工作,但是,和 Spring 一样,你不知道魔法是如何工作的,即使在使用这个框架多年之后 - 你必须用谷歌搜索大量时间来解开哪里出了问题并解
我正在编写一个脚本,用于将文件上传到需要多部分请求的 cgi 脚本,例如 HTML 页面上的表单。 boundary 是一个唯一的标记,用于注释请求正文中的文件内容。这是一个示例正文: --BOUND
我有一个带有 Netty 的 jersy 2.13 的服务器应用程序,我尝试上传带有“multipart/form-data”的文件,但出现此错误。 错误信息: 7605 10:01:49.309
来自文档:“当您使用 TransferManager 下载文件时,该实用程序会自动确定对象是否为多部分” 来源:https://aws.amazon.com/fr/blogs/developer/pa
我需要有关发送多部分发布请求的帮助。主要问题是服务器无法识别我请求的帖子正文部分。服务器端在 android 上运行良好,但在 Qt 和 NetworkAccessManager 上运行不佳。 代码如
在 fragment B 中,我有一个用于将图像提交到服务器的提交按钮。单击提交按钮时,它将返回到 fragment A。我使用 Multipart 将图像上传到服务器,并且该进程在 Thread 上
我目前正在使用 Spring Boot v1.3.0.BUILD-SNAPSHOT 和 Spring v4.2.2.BUILD-SNAPSHOT。 如果我尝试执行多文件上传(通过 angular):
当我使用 JavaMailSender 发送带有附件的电子邮件时,它总是失败并抛出以下异常: org.springframework.mail.MailSendException: Failed me
我正在尝试在 NodeJS 上手动解析 multipart/formdata 请求。 请求中的所有内容均已正确解析(文件除外)。我正在读取文件数据,但它的长度比原始的短(在fiddler中,选择hex
我是一名优秀的程序员,十分优秀!