Skip to content

Instantly share code, notes, and snippets.

@brianjlandau
Forked from reagent/check-gzip
Last active July 14, 2016 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjlandau/e53bc4b9608680d0cb33b2f40f26c47c to your computer and use it in GitHub Desktop.
Save brianjlandau/e53bc4b9608680d0cb33b2f40f26c47c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ ${#1} -eq 0 ]
then echo "Error: Please supply a URL"; exit 1;
fi
ENCODING_HEADER=$(curl --silent -I $1 -H "Accept-Encoding: gzip,deflate" | tr -d '\r' | sed -En 's/^Content-Encoding: (.+)$/\1/p')
if [ "$ENCODING_HEADER" == "gzip" ]
then echo "GZIP: Enabled"
else echo "GZIP: Disabled"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment