Created
December 8, 2013 15:27
-
-
Save wen-long/7859005 to your computer and use it in GitHub Desktop.
Debug PAC File
from http://findproxyforurl.com/debug-pac-file/
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 =""; | |
debugPAC +="IP: " + myIpAddress(); | |
debugPAC +=", Hostname: " + host; | |
if (isResolvable(host)) {resolvableHost = "True"} else {resolvableHost = "False"}; | |
debugPAC +=", Host Resolvable: " + resolvableHost; | |
debugPAC +=", Hostname IP: " + dnsResolve(host); | |
if (isPlainHostName(host)) {plainHost = "True"} else {plainHost = "False"}; | |
debugPAC +=", Plain Hostname: " + plainHost; | |
debugPAC +=", Domain Levels: " + dnsDomainLevels(host); | |
debugPAC +=", URL: " + url; | |
debugPAC = "start" + debugPAC; | |
// 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; | |
// 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