Skip to content

Instantly share code, notes, and snippets.

@egyptiankarim
Last active October 16, 2015 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egyptiankarim/1fdc4bb98f60cd420f05 to your computer and use it in GitHub Desktop.
Save egyptiankarim/1fdc4bb98f60cd420f05 to your computer and use it in GitHub Desktop.
Shortcut for sending HTTP(S) requests from files.
#!/bin/sh
#
# Shortcut for sending HTTP(S) requests from files.
#
# USAGE:
#
# $ bang [target] [request file] [response file (optional)]
usage () {
echo "Usage: $ bang [target] [request file] [response file (optional)]\n"
exit 1
}
if [ "$#" -lt 2 ]; then
usage
fi
if [ "$3" = "" ] ; then
< $2 openssl s_client -crlf -quiet -ign_eof -connect $1
else
< $2 openssl s_client -crlf -quiet -ign_eof -connect $1 > $3
fi
@egyptiankarim
Copy link
Author

I usually drop this into my .dotfiles' bin for quick access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment