Automatic Proxy Config scripts

From: Penisoara Adrian <[email protected]>
Date: Tue, 6 May 1997 22:27:49 +0300 (EEST)

  Thank you all (Oskar, Mark, Ed, Richard) for helping me out.
  I believe I managed to make a pretty usable script, any more
suggestions ?

----------------------------------------------------------
// Automatic Proxy Configuration File
// Last update: 19970506
// Location: http://proxy.warp.starnets.ro/cfg/proxy.pac

function FindProxyForURL(url,host)
{
 // Proxy server status (e.g. working[0] / down[1])
 proxydown=0;

 // Is the proxy server down ?
 if(proxydown)
  return "DIRECT";

 // Is it one of the supported protocols ?
 if( (url.substring(0,5)!="http:") &&
     (url.substring(0,4)!="ftp:") &&
     (url.substring(0,7)!="gopher:") )
  return "DIRECT";

 // Is it a plain hostname ?
 if(isPlainHostName(host))
  return "DIRECT";

 // Is it the 'localhost' alias ?
 if( shExpMatch(host,"localhost.*") ||
     shExpMatch(host,"127.0.0.1") )
  return "DIRECT";

 // Is it in our domain ?
 if( shExpMatch(host,"*warp.starnets.ro") ||
     shExpMatch(host,"193.226.124.*") )
  return "DIRECT";

 // We passed all exception rules, so...
 return "PROXY proxy.warp.starnets.ro:3128 ; DIRECT";
}
-----------------------------------------------------

 Yes, Richard, it's a stupid thing that NNavigator must do an DNS lookup
for an isInNet() call, maybe they shoul optimize it one day...
 Nice workaround for this with the shExpMatch(), Ed! But there are still
some problems, like nonstandard subnet IPs (like us, we have an netmask
of 255.255.255.224).
 Unfortunately I couldn't acces http://squid.nlanr.net, was it down for
some time ? Is the info in the FAQ a must-read anyway ?
 BTW, does anyone know what dnsDomainIs("x.y.foo.bar",".foo.bar") will
return ? Practical should be a true value.

 Ady (@warp.starnets.ro)
Received on Tue May 06 1997 - 14:25:39 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:35:07 MST