HTTP 多范围请求 - headers 响应

HTTP multirange requests - headers in response

我正在使用这样的多范围 http 请求 "curl --range 1-2,2-3 http://some.url" 响应就像

--00000000000000030705 Content-Type: text/html; charset=utf-8 Content-Range: bytes 1-2/13882393

il --00000000000000030705 Content-Type: text/html; charset=utf-8 Content-Range: bytes 2-3/13882393

le --00000000000000030705--

如何从响应中删除字段 Content-Type 和 Content-Range 以从服务器获取原始数据(无需在客户端解析)? 我想得到这样的回应: "ille"

非常感谢!

你可能做不到。服务器符合规范,如 by the RFC 所述。

If multiple parts are being transferred, the server generating the 206 response must generate a "multipart/byteranges" payload, as defined in Appendix A, and a Content-Type header field containing the multipart/byteranges media type and its required boundary parameter. To avoid confusion with single-part responses, a server must not generate a Content-Range header field in the HTTP header section of a multiple part response (this field will be sent in each part instead).

在连续多范围的情况下,服务器可能会发送没有多部分边界的响应,但这是可选的。

When multiple ranges are requested, a server may coalesce any of the ranges that overlap, or that are separated by a gap that is smaller than the overhead of sending multiple parts, regardless of the order in which the corresponding byte-range-spec appeared in the received Range header field. Since the typical overhead between parts of a multipart/byteranges payload is around 80 bytes, depending on the selected representation's media type and the chosen boundary parameter length, it can be less efficient to transfer many small disjoint parts than it is to transfer the entire selected representation.

在多部分负载中每个 body 部分的 header 区域内,服务器必须生成一个 Content-Range header 字段,对应于包含在其中的范围body 部分。如果所选表示在 200(OK)响应中具有 Content-Type header 字段,则服务器应在每个 header 区域中生成相同的 Content-Type 字段 body部分。例如:

假设您的服务器符合规范,发送单个范围 1-3 您将得到一个 body。