| 1 | | function FindProxyForURL(url, host) |
| 2 | | { |
| 3 | | // variable strings to return |
| 4 | | var proxy_yes = "PROXY 127.0.0.1:8123; DIRECT"; |
| 5 | | var proxy_no = "DIRECT"; |
| 6 | | |
| 7 | | if (isPlainHostName(host) |
| 8 | | || isInNet(host, "10.0.0.0", "255.0.0.0") |
| 9 | | || isInNet(host, "127.0.0.0", "255.0.0.0") |
| 10 | | || isInNet(host, "169.254.0.0", "255.255.0.0") |
| 11 | | || isInNet(host, "192.168.0.0", "255.255.0.0") |
| 12 | | ) { return proxy_no; } |
| 13 | | if (url.substring(0, 4) == "ftp:") |
| 14 | | { return proxy_no; } |
| 15 | | if (dnsDomainIs(host, "2ch.net")) |
| 16 | | { return proxy_no; } |
| 17 | | if (shExpMatch(url, "http://www.tumblr.com/api/write/*")) |
| 18 | | { return proxy_no; } |
| 19 | | if (shExpMatch(url, "http://www.lingr.com/api/*")) |
| 20 | | { return proxy_no; } |
| 21 | | if (shExpMatch(url, "http://twitter.com/statuses/*")) |
| 22 | | { return proxy_no; } |
| 23 | | if (shExpMatch(url, "http://www.google.com/reader/atom/*")) |
| 24 | | { return proxy_no; } |
| 25 | | if (shExpMatch(url, "http://*.megalodon.jp/*")) |
| 26 | | { return proxy_no; } |
| 27 | | if (localHostOrDomainIs(host, "idisk.mac.com")) |
| 28 | | { return proxy_no; } |
| 29 | | |
| 30 | | return proxy_yes; |
| | 1 | function FindProxyForURL(url, host) { |
| | 2 | return |
| | 3 | isPlainHostName(host) || |
| | 4 | url.indexOf("ftp:") == 0 || |
| | 5 | //url.indexOf("gopher:") == 0 || // Gopher never die!!! |
| | 6 | dnsDomainIs(host, "2ch.net") || |
| | 7 | /* |
| | 8 | url.indexOf("http://www.tumblr.com/api/write/") == 0 || |
| | 9 | url.indexOf("http://www.lingr.com/api/") == 0 || |
| | 10 | url.indexOf("http://twitter.com/statuses/") == 0 || |
| | 11 | url.indexOf("http://www.google.com/reader/atom/") == 0 || |
| | 12 | shExpMatch(url, "http://*.megalodon.jp/*") || |
| | 13 | */ |
| | 14 | localHostOrDomainIs(host, "idisk.mac.com") || |
| | 15 | isInNet(host, "10.0.0.0", "255.0.0.0") || |
| | 16 | isInNet(host, "127.0.0.0", "255.0.0.0") || |
| | 17 | isInNet(host, "172.16.0.0", "255.240.0.0") || |
| | 18 | isInNet(host, "169.254.0.0", "255.255.0.0") || |
| | 19 | isInNet(host, "192.168.0.0", "255.255.0.0") || |
| | 20 | isInNet(host, "192.0.2.0", "255.255.255.0") || |
| | 21 | isInNet(host, "224.0.0.0", "224.0.0.0") |
| | 22 | ? "DIRECT" |
| | 23 | : "PROXY 127.0.0.1:8123; DIRECT"; |