Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What encoding string tells a web server NOT to send gzip content?

Tags:

http

header

gzip

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.

like image 353
saeed Avatar asked Sep 07 '12 15:09

saeed


People also ask

What Encoding does gzip use?

gzip is based on the DEFLATE algorithm, which is a combination of LZ77 and Huffman coding.

How do I disable gzip content Encoding?

The solution would be to deactivate gzip encoding in the portal and perform any necessary gzip encoding through the HTTP server. However, the gzip encoding cannot be deactivated through a central portal property.

What is content Encoding DEFLATE?

In HTTP/1.1, Content-encoding: deflate actually refers to the DEFLATE compression algorithm, as defined by RFC 1951, wrapped in the zlib data format, as defined by RFC 1950. However some vendors just implement the DEFLATE algorithm as defined RFC 1951, completely ignoring RFC 1950 (no zlib headers).

What is content Encoding HTTP?

Content encoding is mainly used to compress the message data without losing information about the origin media type. Note that the original media/content type is specified in the Content-Type header, and that the Content-Encoding applies to the representation, or "coded form", of the data.


2 Answers

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'

like image 190
dude Avatar answered Oct 04 '22 00:10

dude


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.

like image 37
Joachim Isaksson Avatar answered Oct 03 '22 22:10

Joachim Isaksson