0

Possible Duplicate:
dnsResolve and isInNet functions Problem

We have a Proxy.pac file:

function FindProxyForURL(url, host)

 {

if (dnsResolve("ProxyServer") == "10.1.1.116")     
  if (dnsDomainLevels(host) == 0 || isInNet(host, "10.0.0.0","255.0.0.0") || isInNet(host, "125.0.0.0","255.0.0.0") || isInNet(host, "127.0.0.0","255.0.0.0") || isInNet(host, "204.223.70.250","255.255.255.255") || dnsDomainIs(host, ".muj.com") || dnsDomainIs(host, "sv.com.gt") || dnsDomainIs(host, "com.es.gt"))
       return "DIRECT";
    else
        return "PROXY 10.1.1.116:8080";

 else
     return "DIRECT";
 }

Is working properly, but there are many users that are complaining becauses navigation since proxy.pac deployment is taking to long. It seems dnsResolve and isInNet are the cause of the problem. Is there any other way to improve this script? or how to accelarte dns resolve?

carloslone
  • 51
  • 1
  • 1
  • 3

1 Answers1

1

The way I read it, each time you call isInNet(host, ip, mask), it will attempt to resolve the host from the DNS, meaning multiple resolutions, each of which adds time.

Try resolving it once, assigning this resolved host to a variable, then substituting that for 'host' in all of the isInNet calls speeds things up... something like;

var resolvedIP = dnsResolve(host);

...

isInNet(resolvedIP, "10.0.0.0", "255.0.0.0") 

Caemdare
  • 11
  • 2