1autoproxy(n) HTTP protocol helper modules autoproxy(n)
2
3
4
5______________________________________________________________________________
6
8 autoproxy - Automatic HTTP proxy usage and authentication
9
11 package require Tcl 8.2
12
13 package require http ?2.0?
14
15 package require autoproxy ?1.3?
16
17 ::autoproxy::init
18
19 ::autoproxy::cget -optionname
20
21 ::autoproxy::configure ?-option value?
22
23_________________________________________________________________
24
26 This package attempts to automate the use of HTTP proxy servers in Tcl
27 HTTP client code. It tries to initialize the web access settings from
28 system standard locations and can be configured to negotiate authenti‐
29 cation with the proxy if required.
30
31 On Unix the standard for identifying the local HTTP proxy server seems
32 to be to use the environment variable http_proxy or ftp_proxy and
33 no_proxy to list those domains to be excluded from proxying. On Win‐
34 dows we can retrieve the Internet Settings values from the registry to
35 obtain pretty much the same information. With this information we can
36 setup a suitable filter procedure for the Tcl http package and arrange
37 for automatic use of the proxy.
38
39 There seem to be a number of ways that the http_proxy environment vari‐
40 able may be set up. Either a plain host:port or more commonly a URL and
41 sometimes the URL may contain authentication parameters or these may be
42 requested from the user or provided via http_proxy_user and
43 http_proxy_pass. This package attempts to deal with all these schemes.
44 It will do it's best to get the required parameters from the environ‐
45 ment or registry and if it fails can be reconfigured.
46
48 ::autoproxy::init
49 Initialize the autoproxy package from system resources. Under
50 unix this means we look for environment variables. Under windows
51 we look for the same environment variables but also look at the
52 registry settings used by Internet Explorer.
53
54 ::autoproxy::cget -optionname
55 Retrieve individual package configuration options. See OPTIONS.
56
57 ::autoproxy::configure ?-option value?
58 Configure the autoproxy package. Calling configure with no
59 options will return a list of all option names and values. See
60 OPTIONS.
61
63 host hostname
64
65 proxy_host hostname
66 Set the proxy hostname. This is normally set up by init but may
67 be configured here as well.
68
69 port number
70
71 proxy_port number
72 Set the proxy port number. This is normally set up by init.
73 e.g. configure -port 3128
74
75 no_proxy list
76 You may manipulate the no_proxy list that was setup by init. The
77 value of this option is a tcl list of strings that are matched
78 against the http request host using the tcl string match com‐
79 mand. Therefore glob patterns are permitted. For instance, con‐
80 figure -no_proxy *.localdomain
81
82 authProc procedure
83 This option may be used to set an application defined procedure
84 to be called when configure -basic is called with either no or
85 insufficient authentication details. This can be used to present
86 a dialog to the user to request the additional information.
87
88 -basic Following options are for configuring the Basic authentication
89 scheme parameters. See Basic Authentication.
90
92 Basic is the simplest and most commonly use HTTP proxy authentication
93 scheme. It is described in (1 section 11) and also in (2). It offers no
94 privacy whatsoever and its use should be discouraged in favour of more
95 secure alternatives like Digest. To perform Basic authentication the
96 client base64 encodes the username and plaintext password separated by
97 a colon. This encoded text is prefixed with the word "Basic" and a
98 space.
99
100 The following options exists for this scheme:
101
102 -username name
103 The username required to authenticate with the configured proxy.
104
105 -password password
106 The password required for the username specified.
107
108 -realm realm
109 This option is not used.
110
112 package require autoproxy
113 autoproxy::init
114 autoproxy::configure -basic -username ME -password SEKRET
115 set tok [http::geturl http://wiki.tcl.tk/]
116 http::data $tok
117
118
120 [1] Berners-Lee, T., Fielding R. and Frystyk, H. "Hypertext Trans‐
121 fer Protocol -- HTTP/1.0", RFC 1945, May 1996, (http://www.rfc-
122 editor.org/rfc/rfc1945.txt)
123
124 [2] Franks, J. et al. "HTTP Authentication: Basic and Digest Access
125 Authentication", RFC 2617, June 1999 (http://www.rfc-edi‐
126 tor.org/rfc/rfc2617.txt)
127
129 At this time only Basic authentication (1) (2) is supported. It is
130 planned to add support for Digest (2) and NTLM in the future.
131
133 Pat Thoyts
134
136 http(n)
137
139 authentication, http, proxy
140
141
142
143http 1.3 autoproxy(n)