Thursday, March 28, 2013

Use curl to check website gzip encoding support

If you want to check whether a website has gzip encoding support, you can use curl with Accept-Encoding: gzip.deflate http header. Use size_download to check the size like this.
$ curl --silent -H "Accept-Encoding: gzip,deflate" --write-out "size_download=%{size_download}\n" --output /dev/null size_download=50613
And compare without the Accept-Encoding:
$ curl --silent --write-out "size_download=%{size_download}\n" --output /dev/null size_download=245298
If you see the same result with and without Accept-Encoding, the web server does not support gzip.