autoproxy(n) | HTTP protocol helper modules | autoproxy(n) |
autoproxy - Automatic HTTP proxy usage and authentication
package require Tcl 8.2
package require http ?2.0?
package require autoproxy ?1.5.1?
::autoproxy::init
::autoproxy::cget -optionname
::autoproxy::configure ?-option value?
::autoproxy::tls_connect args
::autoproxy::tunnel_connect args
::autoproxy::tls_socket args
This package attempts to automate the use of HTTP proxy servers in Tcl HTTP client code. It tries to initialize the web access settings from system standard locations and can be configured to negotiate authentication with the proxy if required.
On Unix the standard for identifying the local HTTP proxy server seems to be to use the environment variable http_proxy or ftp_proxy and no_proxy to list those domains to be excluded from proxying. On Windows we can retrieve the Internet Settings values from the registry to obtain pretty much the same information. With this information we can setup a suitable filter procedure for the Tcl http package and arrange for automatic use of the proxy.
There seem to be a number of ways that the http_proxy environment variable may be set up. Either a plain host:port or more commonly a URL and sometimes the URL may contain authentication parameters or these may be requested from the user or provided via http_proxy_user and http_proxy_pass. This package attempts to deal with all these schemes. It will do it's best to get the required parameters from the environment or registry and if it fails can be reconfigured.
The args list may contain any of the tls package options but must end with the host and port as the last two items.
The args list may contain any of the tls package options but must end with the host and port as the last two items.
Note that many proxy servers will permit CONNECT calls to a limited set of ports - typically only port 443 (the secure HTTP port).
Basic is the simplest and most commonly use HTTP proxy authentication scheme. It is described in (1 section 11) and also in (2). It offers no privacy whatsoever and its use should be discouraged in favour of more secure alternatives like Digest. To perform Basic authentication the client base64 encodes the username and plaintext password separated by a colon. This encoded text is prefixed with the word "Basic" and a space.
The following options exists for this scheme:
package require autoproxy autoproxy::init autoproxy::configure -basic -username ME -password SEKRET set tok [http::geturl http://wiki.tcl.tk/] http::data $tok
package require http package require tls package require autoproxy autoproxy::init http::register https 443 autoproxy::tls_socket set tok [http::geturl https://www.example.com/]
At this time only Basic authentication (1) (2) is supported. It is planned to add support for Digest (2) and NTLM in the future.
Pat Thoyts
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category http :: autoproxy of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation.
http(n)
authentication, http, proxy
Networking
1.5.1 | http |