gpt4 book ai didi

http-headers - 接受编码 :gzip and Content-Encoding:gzip

转载 作者:行者123 更新时间:2023-12-03 01:45:14 24 4
gpt4 key购买 nike

这两个 HTTP header 有什么区别?

  • 接受编码:gzip
  • 内容编码:gzip

最佳答案

接受编码:

这是一个请求头。 HTTP 客户端使用此 header 告诉服务器它支持哪种编码。允许服务器以任何这些编码发送响应内容。

From MDN

The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand. Using content negotiation, the server selects one of the proposals, uses it and informs the client of its choice with the Content-Encoding response header.

内容编码:

这是一个响应头。 HTTP 服务器使用此 header 告诉客户端内容实际采用哪种特定编码进行编码。

From MDN

The Content-Encoding entity header is used to compress the media-type. When present, its value indicates which encodings were applied to the entity-body. It lets the client know, how to decode in order to obtain the media-type referenced by the Content-Type header.

如果您想查看它们的实际运行情况,请在 Firefox/Chrome 中打开Inspect Element,然后检查Network 选项卡以查看它们的实际运行情况。在请求 header 中查找 Accept-Encoding,在响应 header 中查找 Content-Encoding

Inspect Element in firefox

关于http-headers - 接受编码 :gzip and Content-Encoding:gzip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46282063/

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