What encoding string tells a web server NOT to sen

2019-02-01 18:12发布

This encoding header tells a web server to send gzip content if available.

'accept-encoding': 'gzip,deflate,sdch',

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.

标签: http header gzip
2条回答
Evening l夕情丶
2楼-- · 2019-02-01 19:02

Not including the accept-encoding header implies that you may want the default encoding, i.e. identity. The caveat here is that the RFC2616 sec 14.3 allows the server to assume any available encoding is acceptable.

To explicitly request plain text, set 'accept-encoding: identity'

查看更多
相关推荐>>
3楼-- · 2019-02-01 19:12

Leaving the encoding out of accept-encoding will disallow that encoding (ie gzip).

If you want to explicitly set it as disallowed, you can set a qvalue of 0.

'accept-encoding': 'gzip;q=0,deflate,sdch'

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.

查看更多
登录 后发表回答