Created
July 12, 2019 12:11
-
-
Save lidel/3f8b05b52da373320b07f248972dbb1d to your computer and use it in GitHub Desktop.
Quick script to check if HTTP server supports compression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
if [ $# -ne 1 ]; then | |
echo 1>&2 "Usage: $0 URL" | |
exit 3 | |
fi | |
echo "Checking $1" | |
curl -L -I -H "Accept-Encoding: gzip,deflate,br" "$1" --silent | grep -i "Content-Encoding:" || echo "Content-Encoding not found in response" | |
echo -ne "compressed:\t" | |
curl -L -H "Accept-Encoding: gzip,deflate,br" "$1" --silent --write-out "%{size_download}" --output /dev/null | |
echo -ne "\nuncompressed:\t" | |
curl -L "$1" --silent --write-out "%{size_download}" --output /dev/null | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment