Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by Chris S Sep 24 '12 at 3:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 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") 

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.