gpt4 book ai didi

http - 使用 http 压缩时的内容长度

转载 作者:可可西里 更新时间:2023-11-01 15:05:01 24 4
gpt4 key购买 nike

客户端正在向 http 服务器发出范围请求 0-1023。它更喜欢 gzip 压缩接受编码:gzip;q=1.0,身份; q=0.5, *;q=0在请求中。

响应 header 中的内容长度是多少?它是 1024 还是压缩数据的大小。

谢谢,

最佳答案

这取决于Content-Encoding

RFC 2616 关于Content-Length 有这样的说法(除其他外):

Applications SHOULD use this field to indicate the transfer-length ofthe message-body, unless this is prohibited by the rules in section4.4.

所以我们必须弄清楚传输长度是多少; Section 4.4 (Message Length) 说了关于传输长度的两件事:

The transfer-length of a message is the length of the message-body asit appears in the message; that is, after any transfer-codings havebeen applied.

If a Content-Length header field (section 14.13) is present, itsdecimal value in OCTETs represents both the entity-length and thetransfer-length. The Content-Length header field MUST NOT be sent ifthese two lengths are different

好的,所以我们知道在这种情况下传输长度、实体长度和内容长度都具有相同的值,并且都指的是“消息正文在消息中出现的长度”,所以我们必须确定消息体是什么。 Section 4.3关于消息正文的说法:

The message-body (if any) of an HTTP message is used to carry theentity-body associated with the request or response."

那么什么是实体主体?为此,您必须基本上引用所有Section 7。 . (这也定义了实体长度。)最重要的是,这里有:

entity-body := Content-Encoding( Content-Type( data ) )

实体主体的长度(以及我们根据 4.4 的 Content-Length 值)是内容编码后的数据长度。

关于http - 使用 http 压缩时的内容长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3819280/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com