in reply to Know the logic behind a script.

The script uses data from text files in folder /opt/proxypac

cross-use.txt
data-x.txt
default.txt
net-routing.txt
proxy-x.txt
special-routing.txt

to dynamically build a javascript function FindProxyForURL(url, host) something like this

Content-type: application/x-ns-proxy-autoconfig /* ** automatic proxy configuration V$version for $ipAddr from $ENV{'SERV +ER_NAME'} ($ENV{'SERVER_ADDR'}) */ function FindProxyForURL(url, host) { var proxy="PROXY $proxy1; PROXY $proxy2"; if ( shExpMatch(host, "localhost") ) { return "DIRECT"; } if ( shExpMatch(host, "localhost.*") ) { return "DIRECT"; } if ( shExpMatch(host, "127.0.0.*") ) { return "DIRECT"; } if ( isPlainHostName(host) ) { return "DIRECT"; } if ( isInNet(myIpAddress(), "10.255.32.0", "255.255.240.0")) { retu +rn "DIRECT"; } if ( dnsDomainIs(host, "$webServer") ) { $dnsq return $proxy; } if (shExpMatch(host,"$webServer") ) { $dnsq return $proxy; } if (host == "$webServer") { $dnsq return $proxy; } if (isResolvable(host)) { resolved_host = dnsResolve(host); if ( isInNet(resolved_host, "$webHost","$webHostMask") ) { return + $proxy; } } return proxy }

see Proxy_auto-config. Which part do you not understand ?

poj