Last active
August 29, 2015 14:06
-
-
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.
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
# 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