Created
July 13, 2016 18:13
-
-
Save reagent/17efd968f8d1f76d6486633cec58d25f to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
url = ARGV.pop | |
if url.to_s.strip.length == 0 | |
puts "Error: Please supply a URL" | |
exit 1 | |
end | |
uncompressed_bytes = `curl "#{url}" --silent --write-out "%{size_download}\n" --output /dev/null` | |
compressed_bytes = `curl "#{url}" --silent -H "Accept-Encoding: gzip,deflate" --write-out "%{size_download}\n" --output /dev/null` | |
if compressed_bytes.to_i < uncompressed_bytes.to_i | |
puts 'GZIP: Enabled' | |
else | |
puts 'GZIP: Disabled' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment