[WEB4LIB] Re: Automatic proxy configuration files

Charles F. Bearden cbearden at ruf.rice.edu
Thu Apr 15 14:01:52 EDT 1999


On Mon, 12 Apr 1999, Glen Davies wrote:

> Hi
>
> Depending on what you are wanting to do with the autoconfig file it
> can be more flexible if you send it to the browser via a cgi script.
> We use autoconfig files for all of our labs as they are only allowed
> full internet access during certain hours. I wrote a very simple perl
> script that detects the browser ip address and the current time. If it
> is before 7pm the auto config file that gets dished out sends them
> to a restricted proxy, if after 7pm they get sent to a proxy that
> allows full access.

I think that autoconfig files themselves can also incorporate time as
a criterion for choosing a proxy, by means of the weekdayRange(),
dateRange(), and timeRange() functions.  These functions would let
you do without the CGI for date and time checking (although the CGI
may well offer you other criteria that the proxy autoconfig files
can't).

We could add the time criterion to Glen's example by enclosing it in
an "if" statement evaluating timeRange():

       function FindProxyForURL(url, host)
       {
       if (timeRange(7, 19)) {            // between 7am & 7pm
         if (isPlainHostName(host) ||     // if no domain name...
         dnsDomainIs(host, ".cce.ac.nz")) // or if in our domain...
         return "DIRECT";                 // bypass proxy
         else
         return "PROXY 164.45.1.3:8090; DIRECT";
                                          // otherwise use proxy
         }
       } else {                           // if not between 7 & 7...
         return "DIRECT";                 // bypass proxy
       }

Note that I haven't had a chance to test this snippet, but I think 
it's correct and it does illustrate the idea of the time-based 
autoproxy functions.

======================================================================
 Chuck Bearden                                      cbearden at rice.edu
 Electronic Resources Librarian                                   
 Fondren Library--MS44                           713 / 527-8101 x3634
 Rice University                                 713 / 737-5859 (fax)
 P.O. Box 1892                                                    
 Houston, TX 77251-1892                                           
======================================================================



More information about the Web4lib mailing list