- COPYRIGHT AND LICENSE
HTTP::ProxyAutoConfig - use a .pac or wpad.dat file to get proxy information
use HTTP::ProxyAutoConfig; my $pac = HTTP::ProxyAutoConfig->new("http://foo.bar/auto-proxy.pac"); my $pac = new HTTP::ProxyAutoConfig('/Documents and Settings/me/proxy.pac'); my $pac = HTTP::ProxyAutoConfig->new(); my $proxy = $pac->FindProxy('http://www.yahoo.com');
HTTP::ProxyAutoConfig allows perl scripts that need to access the Internet to determine whether to do so via a proxy server. To do this, it uses proxy settings provided by an IT department, either on the Web or in a browser's .pac file on disk.
It provides means to find the proxy server (or lack of one) for a given URL. If your application has located either a wpad.dat file or a .pac file, HTTP::ProxyAutoConfig processes it to determine how to handle a particular destination URL. If it's not given a wpad.dat or .pac file, HTTP::ProxyAutoConfig tests environment variables to determine whether there's a proxy server.
Mapping from a URL to the proxy information is provided by a FindProxyForURL(url, host) or FindProxy(url) function call. Both functions return a string that tells your application what to do, namely a direct connection to the Internet or a connection via a proxy server.
The Proxy Auto Config format and rules were originally developed at Netscape. The Netscape documentation is archived at http://linuxmafia.com/faq/Web/autoproxy.html
More recent references include:
This call creates the FindProxyForURL function and the object through which it can be called. The url_or_file argument is optional, and points to the auto-proxy file provided on your network or a file used by your browser. If there is no argument, HTTP::ProxyAutoConfig will check the http_auto_proxy environment variable, followed by the http_proxy, https_proxy, and ftp_proxy variables.
As shown above, you can use either the HTTP::ProxyAutoConfig->new() or the new HTTP::ProxyAutoConfig() form, but don't use the HTTP::ProxyAutoConfig::new() form.
This takes the url, and the host (minus port) from the URL, and determines the action you should take to contact that host. It returns one of three strings:
DIRECT - connect directly PROXY host:port - connect via the proxy SOCKS host:port - connect via SOCKS
This result can be used to configure a net-access module like LWP.
Same as the previous call, except you don't have to extract the host from the URL.
By Ryan Eatmon in May of 2001 0.2 by Craig MacKenna, March 2010
Copyright (C) 2001, Ryan Eatmon Copyright (C) 2010, Craig MacKenna
This module is free software; you may redistribute it and/or modify it under the same terms as Perl 5.10.1. For more details, see the full text of the licenses at http://www.perlfoundation.org/artistic_license_1_0 and http://www.gnu.org/licenses/gpl-2.0.html
This program is distributed in the hope that it will be useful, but it is provided 'as is' and without any express or implied warranties. For details, see the full text of the licenses at the above URLs.