Skip to content

Instantly share code, notes, and snippets.

@reagent
Created July 13, 2016 18:13
Show Gist options
  • Save reagent/17efd968f8d1f76d6486633cec58d25f to your computer and use it in GitHub Desktop.
Save reagent/17efd968f8d1f76d6486633cec58d25f to your computer and use it in GitHub Desktop.
#!/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