Skip to content

Instantly share code, notes, and snippets.

@ypetya
Last active August 29, 2015 14:06
Show Gist options
  • Save ypetya/f058a215c6f91fef6c27 to your computer and use it in GitHub Desktop.
Save ypetya/f058a215c6f91fef6c27 to your computer and use it in GitHub Desktop.
getproxies bash function. Call it with the PAC proxy url. It will try to use it with curl connecting to githubs https to check wether this PROXY is good for https connection or not.
# use with argument $1 - proxy auto discovery address
function getproxies() {
PROXIES=( $(curl $1 2>/dev/null | perl -ne 'if(/PROXY ([^";]*)/g){ print "$1\n";}'))
for proxy in ${PROXIES[*]} ; do
if "curl" -s -x $proxy --connect-timeout 5 https://github.com &> /dev/null ; then
echo "$proxy : OK"
else
echo "$proxy : not working $?"
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment