proxy.pac for polipo

google apps for your domain に polipo 経由だとあたれないみたいなのでいまさらながら proxy.pac を弄った。
https接続だとOKだけど、http接続だとダメ。
いままでは、http://www.otsune.com/files/proxy.pacを直接指定してたけど、編集しなきゃいけないので、ローカルに落した。どこに置くかひとしきり悩んだ。
localHostOrDomainIs()がいいんだかdnsDomainIs()がいいんだか判断つきかねる。
https接続はpolipoに廻しているんだけど、どうしてhttps接続だとだいじょうぶなんだかわからん。
あー、ちなみに普通のgmailは問題が発生しなかったのでした。よくわからんて。
弄った proxy.pac を貼っておく。なんの役に立つかわからんけど。

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://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://mail.google.com/*"))
//    if (localHostOrDomainIs(host, "mail.google.com"))
    if (dnsDomainIs(host, "mail.google.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;
}

polipoが落ちててもDirectで接続するようになってるんだな。


リファレンス: