<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Yi_Tian&#39;s Blog</title>
    <id>http://zhu-zixin.appspot.com/</id>
    <subtitle>胡思乱想的Yi_Tian</subtitle>
    <link href="http://zhu-zixin.appspot.com" />
    <link href="http://zhu-zixin.appspot.com/feed" rel="self" />
    <updated>2011-05-28T13:54:15Z</updated>
    <author>
      <name>1990.zhuzixin</name>
    </author>

  <entry>
      <link href="http://zhu-zixin.appspot.com/?p=205002"/>
      <id>http://zhu-zixin.appspot.com/entry/</id>
      <title>wallproxy配置</title>
      <content type="html"><![CDATA[
      <div><div><br /></div><div>gaehost_http = 'www.google.cn|www.google.com.hk'</div><div>gaehost_https = 'www.google.com.hk'</div><div><br /></div><div>https = False</div><div><br /></div><div>pac = False</div><div><br /></div><div>onlyone = '***.com'</div><div><br /></div><div>usephp = '****.com'</div><div><br /></div><div>usego = '*****.com'</div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div>gae_extra_option = {</div><div><span style="white-space:pre">	</span>#'range0': 100000,</div><div><span style="white-space:pre">	</span>#'range': 500000,</div><div><span style="white-space:pre">	</span>#'max_threads': 10,</div><div><span style="white-space:pre">	</span>#'headers': 'Content-Type: application/octet-stream',</div><div><span style="white-space:pre">	</span>#'proxy': '',</div><div>}</div><div><br /></div><div>if appid:</div><div><span style="white-space:pre">	</span>if isinstance(crypto, basestring): crypto += '|'*20</div><div><span style="white-space:pre">	</span>if isinstance(password, basestring): password += ('|'+password)*20</div><div><span style="white-space:pre">	</span>app = zip(*(app.split('|') if isinstance(app, basestring) else app</div><div><span style="white-space:pre">				</span>for app in (appid, crypto, password)))</div><div><span style="white-space:pre">	</span>gaeproxy = []; https = 'https' if https else 'http'</div><div><span style="white-space:pre">	</span>for appid,crypto,password in app:</div><div><span style="white-space:pre">		</span>appid = {'url': '%s://%s.appspot.com/%s.py' % (https, appid, server_type)}</div><div><span style="white-space:pre">		</span>if crypto: appid['crypto'] = crypto</div><div><span style="white-space:pre">		</span>appid['key'] = password</div><div><span style="white-space:pre">		</span>gaeproxy.append(appid)</div><div><span style="white-space:pre">	</span>gaeproxy[0].update(gae_extra_option)</div><div><span style="white-space:pre">	</span>gaeproxy[0].setdefault('proxy', '')</div><div><span style="white-space:pre">	</span>del plugins['plugins.gaeproxy'], app</div><div><span style="white-space:pre">	</span>plugins['plugins.'+server_type] = 'gaeproxy'</div><div>if 'gaehost_http' in vars() and isinstance(gaehost_http, basestring):</div><div><span style="white-space:pre">	</span>gaehost_http = gaehost_http and gaehost_http.split('|') or None</div><div>if 'gaehost_https' in vars() and isinstance(gaehost_https, basestring):</div><div><span style="white-space:pre">	</span>gaehost_https = gaehost_https and gaehost_https.split('|') or None</div><div>if isinstance(onlyone, basestring):</div><div><span style="white-space:pre">	</span>onlyone = onlyone and onlyone.split('|') or []</div><div>if isinstance(usephp, basestring):</div><div><span style="white-space:pre">	</span>usephp = usephp and usephp.split('|') or []</div><div>if isinstance(usego, basestring):</div><div><span style="white-space:pre">	</span>usego = usego and usego.split('|') or []</div><div>def find_http_handler(method, url, headers):</div><div><span style="white-space:pre">	</span>if len(gaeproxy)&gt;1 and onlyone:</div><div><span style="white-space:pre">		</span>for host in onlyone:</div><div><span style="white-space:pre">			</span>if dnsDomainIs(url.hostname, host): return gaeproxy[0]</div><div><span style="white-space:pre">	</span>if len(forold)&gt;0 and usephp:</div><div><span style="white-space:pre">		</span>for host in usephp:</div><div><span style="white-space:pre">			</span>if dnsDomainIs(url.hostname, host): return forold</div><div><span style="white-space:pre">	</span>if len(goagent)&gt;0 and usego:</div><div><span style="white-space:pre">		</span>for host in usego:</div><div><span style="white-space:pre">			</span>if dnsDomainIs(url.hostname, host): return goagent</div><div><span style="white-space:pre">	</span>return gaeproxy</div><div>if not pac: del plugins['plugins.autoproxy']</div><div>del (server_type, appid, password, crypto, https, pac, gae_extra_option)</div><div>#find_http_handler = print_result(find_http_handler, lambda r,m,u,h:'%s %s'%(u.geturl(),r))</div><div>#find_http_handler = print_result(find_http_handler)&nbsp;</div></div><div><br /></div><div><br /></div><div><br /></div>
      
                <h4>相关阅读：</h4>
                  <ul>
                
                  <li><a href="http://zhu-zixin.appspot.com/about">关于</a></li>
                
                </ul>
                
                <p>本文网址:<a href="http://zhu-zixin.appspot.com/?p=205002">http://zhu-zixin.appspot.com/?p=205002</a></p>

      ]]></content>
      <author>
          <name>1990.zhuzixin</name>
      </author>
      <updated>2011-05-28T13:54:15Z</updated>
  </entry>

</feed>
