Skip to content

Instantly share code, notes, and snippets.

@reagent
Created July 13, 2016 18:13
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#!/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