Last active
May 5, 2020 03:07
-
-
Save JoeyTeng/7c7a05976b8b6ac354b6c1df884f3484 to your computer and use it in GitHub Desktop.
pac_debug
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
function FindProxyForURL(url, host) { | |
debugPAC ="PAC Debug Information\n"; | |
debugPAC +="-----------------------------------\n"; | |
debugPAC +="Machine IP: " + myIpAddress() + "\n"; | |
debugPAC +="Hostname: " + host + "\n"; | |
if (isResolvable(host)) {resolvableHost = "True"} else {resolvableHost = "False"}; | |
debugPAC +="Host Resolvable: " + resolvableHost + "\n"; | |
debugPAC +="Hostname IP: " + dnsResolve(host) + "\n"; | |
if (isPlainHostName(host)) {plainHost = "True"} else {plainHost = "False"}; | |
debugPAC +="Plain Hostname: " + plainHost + "\n"; | |
debugPAC +="Domain Levels: " + dnsDomainLevels(host) + "\n"; | |
debugPAC +="URL: " + url + "\n"; | |
// Protocol can only be determined by reading the entire URL. | |
if (url.substring(0,5)=="http:") {protocol="HTTP";} else | |
if (url.substring(0,6)=="https:") {protocol="HTTPS";} else | |
if (url.substring(0,4)=="ftp:") {protocol="FTP";} | |
else {protocol="Unknown";} | |
debugPAC +="Protocol: " + protocol + "\n"; | |
// Reduce volume of alerts to a useable level, e.g. only alert on static text pages. | |
if (!shExpMatch(url,"*.(js|xml|ico|gif|png|jpg|jpeg|css|swf)*")) {alert(debugPAC);} | |
return "DIRECT"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment