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

In reply to Re: Know the logic behind a script. by poj
in thread Know the logic behind a script. by ramesh.mju

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.