什么编码字符串告诉 Web 服务器不要发送 gzip 内容? [英] What encoding string tells a web server NOT to send gzip content?
问题描述
此编码标头告诉 Web 服务器发送 gzip 内容(如果可用).
This encoding header tells a web server to send gzip content if available.
'accept-encoding': 'gzip,deflate,sdch',
如何指示网络服务器发送纯文本而不是压缩内容?我知道如果 Web 服务器愿意,它可以简单地忽略此请求.
How can I instruct the web server to send plain text and not gzip the content? I am aware that the web server can simply ignore this request if it wanted to.
推荐答案
将编码排除在接受编码之外将不允许该编码(即 gzip).
Leaving the encoding out of accept-encoding will disallow that encoding (ie gzip).
如果您想明确将其设置为不允许,您可以将 qvalue
设置为 0.
If you want to explicitly set it as disallowed, you can set a qvalue
of 0.
'accept-encoding': 'gzip;q=0,deflate,sdch'
您可以在 RFC2616,但简而言之,如果服务器在列出的编码中找不到可接受的编码(身份是一种特殊情况,请参阅链接),它应该发送一个 406(不可接受)响应并且不回复您的任何请求其他编码.
You can read more under accept-encoding in RFC2616, but in short if the server can't find an acceptable encoding among the ones listed (identity being a special case, see the link), it should send a 406 (Not Acceptable) response and not reply to your request with any other encoding.
这篇关于什么编码字符串告诉 Web 服务器不要发送 gzip 内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!