+
+ // MS CARP hack
+ Vector carpHosts = new Vector();
+ for(int i=0; i<script.length(); i++)
+ if (script.regionMatches(i, "new Node(", 0, 9)) {
+ String host = script.substring(i + 10, script.indexOf('\"', i + 11));
+ if (Log.on) Log.log(HTTP.ProxyInfo.class, "Detected MS Proxy Server CARP Script, Host=" + host);
+ carpHosts.addElement(host);
+ }
+ if (carpHosts.size() > 0) {
+ script = "function FindProxyForURL(url, host) {\nreturn \"";
+ for(int i=0; i<carpHosts.size(); i++)
+ script += "PROXY " + carpHosts.elementAt(i) + "; ";
+ script += "\";\n}";
+ if (Log.on) Log.log(HTTP.ProxyInfo.class, "DeCARPed PAC script:");
+ if (Log.on) Log.log(HTTP.ProxyInfo.class, script);
+ }
+