跳到主要内容

附录 A. Internet 媒体类型 multipart/byteranges (Internet Media Type multipart/byteranges)

当 206 (Partial Content) 响应消息包含多个范围的内容时, 它们作为主体部分在媒体类型为 "multipart/byteranges" 的多部分消息主体 ([RFC2046] 第 5.1 节) 中传输.

multipart/byteranges 媒体类型包含一个或多个主体部分, 每个部分都有自己的 Content-Type 和 Content-Range 字段. 必需的 boundary 参数指定用于分隔各主体部分的边界字符串.

实现注意事项 (Implementation Notes):

  1. 在主体中第一个边界字符串之前可能存在额外的 CRLF.

  2. 尽管 [RFC2046] 允许边界字符串加引号, 但一些现有实现对带引号的边界字符串处理不正确.

  3. 许多客户端和服务器是按照 byteranges 规范的早期草案编写的, 该草案使用的媒体类型为 multipart/x-byteranges, 它与本类型几乎 (但不完全) 兼容.

尽管名称如此, "multipart/byteranges" 媒体类型并不限于字节范围. 以下示例使用了 "exampleunit" 范围单位:

HTTP/1.1 206 Partial Content
Date: Tue, 14 Nov 1995 06:25:24 GMT
Last-Modified: Tue, 14 July 04:58:08 GMT
Content-Length: 2331785
Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES

--THIS_STRING_SEPARATES
Content-Type: video/example
Content-Range: exampleunit 1.2-4.3/25

...the first range...
--THIS_STRING_SEPARATES
Content-Type: video/example
Content-Range: exampleunit 11.2-14.3/25

...the second range
--THIS_STRING_SEPARATES--