PageRenderTime 162ms CodeModel.GetById 81ms app.highlight 2ms RepoModel.GetById 78ms app.codeStats 0ms

/repository/microbang.td

http://snova.googlecode.com/
Unknown | 41 lines | 35 code | 6 blank | 0 comment | 0 complexity | 95bcb14cbb1cb376ddd61cdd3f3bb4aa MD5 | raw file
 1
 2##Reserved proxy implementation
 3$GAE="GAE";
 4$DIRECT="DIRECT";
 5$GOOGLE="Google";
 6$HOSTS="Hosts";
 7
 8def OnInit()
 9{
10  ##Do your business
11}
12
13def OnRoutine()
14{
15   #Do your routine business here
16   #eg: $output=System("./mysh.sh");
17   #    Log($output);
18   #Tell the script engine to invoke this method 10s later
19   return 10;
20}
21
22def SelectProxy(protocol, method, url, headers)
23{ 
24     $host = GetHeader($headers, "Host");
25     if $protocol == "https" && InHosts($host)
26     {
27        return $HOSTS;
28     }
29     
30     if $host~=".google" || $host~="ytimg."|| $host~="gstatic."|| $host~="developer.android.com" || $host~=".appspot.com"  
31	    || $host~="www.youtube.com" || $host~="golang.org" 
32     { 
33        return $GOOGLE;
34     }
35     
36     if InHosts($host)
37     {
38        return $HOSTS;
39     }
40     return $GOOGLE;
41}