Created
March 3, 2015 20:41
-
-
Save kevinkarwaski/1e91b76fa19451be67f8 to your computer and use it in GitHub Desktop.
Curl response headers helper
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 bash | |
# Return only response headers from Curl. | |
# | |
# Usage: curlHeaders http://www.someaddress.com | |
curl -k -s -D - $1 -o /dev/null |
also keep in mind -k
should be used sparingly because you are blindly ignoring invalid certs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Suggestion:
I placed the options before the URL, added
-f
to cause curl to return a non-0 exitcode for non-200 responses and quoted the variable$1
to prevent globbing, ref: https://github.com/koalaman/shellcheck/wiki/SC2086