What does `Accept-Encoding: gzip,deflate` mean?
Can someone explain what it means when I see Accept-Encoding: gzip,deflate
when listening with ncat
?
Does it mean the body is compressed? And if so, how can I decompress it?
$ nc -lnvp 4000
Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000
Ncat: Connection from 10.10.10.10.
Ncat: Connection from 10.10.10.10:33096.
POST /?watch_id=example HTTP/1.1
Accept-Charset: UTF-8
Content-Length: 0
Host: example.com:4000
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.10 (Java/15.0.1)
Accept-Encoding: gzip,deflate
Solution 1:
It means the client can accept a response which has been compressed using the DEFLATE algorithm. https://en.wikipedia.org/wiki/Deflate This algorithm is also used in gzip compression format.
It does not mean the response will be compressed - that requires the server to be configured to compress, which is normally settable per file type. For example there is no point trying to compress jpegs, but for a length text output such as the html body or css, it can reduce bandwidth - at the cost of the server's CPU in compression.