Skip to content

Instantly share code, notes, and snippets.

@Hamcha
Created September 24, 2012 14:50
Show Gist options
  • Save Hamcha/3776330 to your computer and use it in GitHub Desktop.
Save Hamcha/3776330 to your computer and use it in GitHub Desktop.
function gzip-test()
{
curl -I -s -H 'Accept-Encoding: gzip,deflate' $1 | grep Content-Encoding: || echo "No compression enabled"
}
function gzip-test-x()
{
curl -I -s -H 'Accept-Encoding: gzip,deflate' $1 | grep Content-Encoding: || print -P -- "$FX[bold]$FG[001][ERROR]%f GZip Not Enabled$FX[reset]"; return
NOGZIP=`curl -so /dev/null $1 -w '%{size_download}'`
GZIP=`curl --compressed -so /dev/null $1 -w '%{size_download}'`
echo $((100.0-100.0*GZIP/NOGZIP))%
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment