Skip to content

Instantly share code, notes, and snippets.

@taizooo
Created August 13, 2008 00:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taizooo/5165 to your computer and use it in GitHub Desktop.
Save taizooo/5165 to your computer and use it in GitHub Desktop.
// proxy.pac
// for polipo user
// ref : http://subtech.g.hatena.ne.jp/otsune/20080229/proxypac
function FindProxyForURL(url, host)
{
// variable strings to return
var proxy_yes = "PROXY 127.0.0.1:8123; DIRECT";
var proxy_no = "DIRECT";
if (isPlainHostName(host))
{ return proxy_no; }
if (url.substring(0, 4) == "ftp:")
{ return proxy_no; }
if (dnsDomainIs(host, "2ch.net"))
{ return proxy_no; }
if (shExpMatch(url, "http://www.tumblr.com/api/write/*"))
{ return proxy_no; }
if (shExpMatch(url, "http://d.hatena.ne.jp/*"))
{ return proxy_no; }
if (shExpMatch(url, "http://*.g.hatena.ne.jp/*"))
{ return proxy_no; }
if (shExpMatch(url, "http://www.lingr.com/api/*"))
{ return proxy_no; }
if (shExpMatch(url, "http://twitter.com/statuses/*"))
{ return proxy_no; }
if (shExpMatch(url, "http://www.google.com/reader/atom/*"))
{ return proxy_no; }
if (shExpMatch(url, "http://*.megalodon.jp/*"))
{ return proxy_no; }
if (localHostOrDomainIs(host, "idisk.mac.com"))
{ return proxy_no; }
if (shExpMatch(url, "http://*.tadalist.com/*"))
{ return proxy_no; }
if (shExpMatch(url, "http://appjet.com/*"))
{ return proxy_no; }
if (shExpMatch(url, "http://userstyles.org/*"))
{ return proxy_no; }
if (dnsDomainIs(host, "movatwitter.jp"))
{ return proxy_no; }
// if (shExpMatch(url, "http://mail.google.com/*"))
// if (localHostOrDomainIs(host, "mail.google.com"))
if (dnsDomainIs(host, "mail.google.com"))
{ return proxy_no; }
if (dnsDomainIs(host, "mail.syowa.com"))
{ return proxy_no; }
if (isInNet(host, "10.0.0.0", "255.0.0.0") ||
isInNet(host, "127.0.0.0", "255.0.0.0") ||
isInNet(host, "169.254.0.0", "255.255.0.0") ||
isInNet(host, "192.168.0.0", "255.255.0.0")
) { return proxy_no; }
return proxy_yes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment