1HTTP::ProxyAutoConfig(3U)ser Contributed Perl DocumentatiHoTnTP::ProxyAutoConfig(3)
2
3
4
6 HTTP::ProxyAutoConfig - use a .pac or wpad.dat file to get proxy
7 information
8
10 use HTTP::ProxyAutoConfig;
11
12 my $pac = HTTP::ProxyAutoConfig->new("http://foo.bar/auto-proxy.pac");
13 my $pac = new HTTP::ProxyAutoConfig('/Documents and Settings/me/proxy.pac');
14 my $pac = HTTP::ProxyAutoConfig->new();
15
16 my $proxy = $pac->FindProxy('http://www.yahoo.com');
17
19 HTTP::ProxyAutoConfig allows perl scripts that need to access the
20 Internet to determine whether to do so via a proxy server. To do this,
21 it uses proxy settings provided by an IT department, either on the Web
22 or in a browser's .pac file on disk.
23
24 It provides means to find the proxy server (or lack of one) for a given
25 URL. If your application has located either a wpad.dat file or a .pac
26 file, HTTP::ProxyAutoConfig processes it to determine how to handle a
27 particular destination URL. If it's not given a wpad.dat or .pac file,
28 HTTP::ProxyAutoConfig tests environment variables to determine whether
29 there's a proxy server.
30
31 A wpad.dat or .pac file contains a JavaScript function called
32 FindProxyForURL. This module allows you to call the function to learn
33 how to access various URLs.
34
35 Mapping from a URL to the proxy information is provided by a
36 FindProxyForURL(url, host) or FindProxy(url) function call. Both
37 functions return a string that tells your application what to do,
38 namely a direct connection to the Internet or a connection via a proxy
39 server.
40
41 The Proxy Auto Config format and rules were originally developed at
42 Netscape. The Netscape documentation is archived at
43 <http://linuxmafia.com/faq/Web/autoproxy.html>
44
45 More recent references include:
46
47 <http://en.wikipedia.org/wiki/Proxy_auto-config>
48 <http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol>
49 <http://www.craigjconsulting.com/proxypac.html>
50 <http://www.returnproxy.com/proxypac/>
51
53 new( url_or_file )
54 This call creates the FindProxyForURL function and the object through
55 which it can be called. The url_or_file argument is optional, and
56 points to the auto-proxy file provided on your network or a file used
57 by your browser. If there is no argument, HTTP::ProxyAutoConfig will
58 check the http_auto_proxy environment variable, followed by the
59 http_proxy, https_proxy, and ftp_proxy variables.
60
61 As shown above, you can use either the HTTP::ProxyAutoConfig->new() or
62 the new HTTP::ProxyAutoConfig() form, but don't use the
63 HTTP::ProxyAutoConfig::new() form.
64
65 FindProxyForURL( url, host )
66 This takes the url, and the host (minus port) from the URL, and
67 determines the action you should take to contact that host. It returns
68 one of three strings:
69
70 DIRECT - connect directly
71 PROXY host:port - connect via the proxy
72 SOCKS host:port - connect via SOCKS
73
74 This result can be used to configure a net-access module like LWP.
75
76 FindProxy( url )
77 Same as the previous call, except you don't have to extract the host
78 from the URL.
79
81 By Ryan Eatmon in May of 2001
82 0.2 by Craig MacKenna, March 2010
83
85 Copyright (C) 2001, Ryan Eatmon
86 Copyright (C) 2010, Craig MacKenna
87
88 This module is free software; you may redistribute it and/or modify it
89 under the same terms as Perl 5.10.1. For more details, see the full
90 text of the licenses at
91 <http://www.perlfoundation.org/artistic_license_1_0> and
92 <http://www.gnu.org/licenses/gpl-2.0.html>
93
94 This program is distributed in the hope that it will be useful, but it
95 is provided 'as is' and without any express or implied warranties. For
96 details, see the full text of the licenses at the above URLs.
97
98
99
100perl v5.32.1 2021-01-27 HTTP::ProxyAutoConfig(3)