//Copyright (c) 1997-2004 Microsoft Corporation
BackupRoute="DIRECT";
UseDirectForLocal=true;
function MakeIPs(){
}
DirectIPs=new MakeIPs();
cDirectIPs=0;
function MakeNames(){
}
DirectNames=new MakeNames();
cDirectNames=0;
HttpPort="8080";
cNodes=1;
function MakeProxies(){
this[0]=new Node("10.245.10.254",0,1.000000);
}
Proxies = new MakeProxies();
function Node(name, hash, load){
this.name = name;
this.hash = hash;
this.load = load;
this.score = 0;
return this;
}
function FindProxyForURL(url, host){
var urlhash, urllower, ibest, bestscore, list, i, j, port=HttpPort;
urllower = url.toLowerCase();
if((urllower.substring(0,5)=="rtsp:")
||
(urllower.substring(0,6)=="rtspt:") ||
(urllower.substring(0,6)=="rtspu:") ||
(urllower.substring(0,4)=="mms:")
||
(urllower.substring(0,5)=="mmst:")
||
(urllower.substring(0,5)=="mmsu:"))
return "DIRECT";
if (UseDirectForLocal && isPlainHostName(host))
return "DIRECT";
if (cDirectNames > 0)
for (i = 0; i < cDirectNames; i++)
if (shExpMatch(host, DirectNames[i]))
return "DIRECT";
if (cDirectIPs > 0)
for (i = 0; i < cDirectIPs; i += 2)
if (isInNet(host, DirectIPs[i], DirectIPs[i+1]))
return "DIRECT";
urlhash = HashString(url);
for (i = 0; i < cNodes; i++)
Proxies[i].score = Proxies[i].load * Scramble(MakeInt(urlhash ^ Proxies[i].hash));
list = "";
for (j = 0; j < cNodes; j++) {
for (bestscore = -1, i = 0; i < cNodes; i++) {
if (Proxies[i].score > bestscore) {
bestscore = Proxies[i].score;
ibest = i;
}
}
Proxies[ibest].score = -1;
list = list + "PROXY " + Proxies[ibest].name + ":" + port + "; ";
}
list = list + BackupRoute;
return list;
}
function HashString(url){
var h = 0;
var slashes = 0;
for (var i = 0; i < url.length; i++) {
var c = url.charAt(i);
if (c == '/')
slashes++;
if (slashes < 3)
c = c.toLowerCase();
h += (((h & 0x1fff) << 19) | ((h >> 13) & 0x7ffff)) + CharToAscii(c);
h = MakeInt(h);
}
return h;
}
function Scramble(h){
h += ((h & 0xffff) * 0x1965) + ((((h >> 16) & 0xffff) * 0x1965) << 16) + (((h & 0xffff) * 0x6253) << 16);
h = MakeInt(h);
h += (((h & 0x7ff) << 21) | ((h >> 11) & 0x1fffff));
return MakeInt(h);
}
var Chars =" !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
???????????????????????? ";
function CharToAscii(c){
return Chars.indexOf(c) + 32;
}
function MakeInt(x){
if (x < 0) {
return x + 4294967296;
} else if (x >= 4294967296) {
return x - 4294967296;
}
return x;
}