Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Know the logic behind a script.

by poj (Abbot)
on Jul 25, 2019 at 12:30 UTC ( [id://11103368]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11103368]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-26 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found