autoproxy(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– autoproxy β€” the Tcl manual page, but make it make sense πŸ’–

okay bestie, so this is autoproxy, a page from section 3tcl of the manual (that's the Tcl library manual, iykyk). It lives in the HTTP protocol helper modules corner of the world. Let's get into it 🫢


✨ NAME ✨

autoproxy β€” automatic HTTP proxy usage and authentication. yes, it does the proxy thing for you, we love a self-sufficient icon πŸ‘‘


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require http ?2.0?

package require autoproxy ?1.8.1?

::autoproxy::init

::autoproxy::cget -option

::autoproxy::configure ?-option value?

::autoproxy::tls_connect args

::autoproxy::tunnel_connect args

::autoproxy::tls_socket args

πŸ¦‹ DESCRIPTION πŸ¦‹

So this package is out here trying to automate the whole "using an HTTP proxy server in Tcl HTTP client code" situation. It tries to initialize your web access settings from the system's standard locations, and if you need it to, you can configure it to negotiate authentication with the proxy. very much giving "I'll handle it, you relax" πŸ’…

On Unix, the standard way to identify your local HTTP proxy server seems to be using the environment variable http_proxy or ftp_proxy, plus no_proxy to list the domains that should be excluded from proxying. On Windows, we can pull the Internet Settings values straight out of the registry and get pretty much the same info. With all that, we can set up a suitable filter procedure for the Tcl http package and arrange for automatic use of the proxy. iconic behavior, no cap ✨

There seem to be a number of ways the http_proxy environment variable might be set up, and honestly they're all a little different. Either a plain host:port, or more commonly a URL β€” and sometimes that URL contains authentication parameters, or those get requested from the user, or they're provided via http_proxy_user and http_proxy_pass. This package attempts to deal with all of these schemes. It'll do its best to get the required parameters from the environment or registry, and if it fails, it can be reconfigured. resilient queen πŸ’–


πŸ” TLS SECURITY CONSIDERATIONS πŸ”

Note: this section only applies if TLS support is provided by the TLS package. It does not apply when autoproxy was configured to use some other package which can provide the same thing (i.e. twapi), via the -tls_package configuration option. okay? okay πŸ’€

This package uses the TLS package to handle the security for https urls and other socket connections.

Policy decisions like the set of protocols to support and what ciphers to use are not the responsibility of TLS, nor of this package itself. Those decisions belong to whichever application is using the package, and they're likely influenced by the set of servers that application will talk to as well. it's giving "not my job, that's your job" πŸ™ˆ

For example β€” in light of the recent POODLE attack discovered by Google (http://googleonlinesecurity.blogspot.co.uk/2014/10/this-poodle-bites-exploiting-ssl-30.html), many servers will disable support for the SSLv3 protocol. To handle this change, the applications using TLS must be patched β€” not this package, and not TLS itself. Such a patch may be as simple as generally activating tls1 support, as shown in the example below.

package require tls
tls::init -tls1 1 ;# forcibly activate support for the TLS1 protocol

... your own application code ...

πŸ‘‘ COMMANDS πŸ‘‘

::autoproxy::init

Initialize the autoproxy package from system resources. Under unix this means we look for environment variables. Under windows we look for the same environment variables but also look at the registry settings used by Internet Explorer. detective work, honestly πŸ”

::autoproxy::cget -option

Retrieve individual package configuration options. See OPTIONS. one lil value at a time, love that for you πŸ’…

::autoproxy::configure ?-option value?

Configure the autoproxy package. Calling configure with no options will return a list of all option names and values. See OPTIONS.

::autoproxy::tls_connect args

Connect to a secure socket through a proxy. HTTP proxy servers permit the use of the CONNECT HTTP command to open a link through the proxy to the target machine. This function hides all those details. For use with the http package, see tls_socket.

The args list may contain any of the options supported by the specific TLS package that is in use, but it must end with the host and port as the last two items. last two, bestie, don't forget πŸŽ€

::autoproxy::tunnel_connect args

Connect to a target host through a proxy. This uses the same CONNECT HTTP command as the tls_connect but does not promote the link security once the connection is established.

The args list may contain any of the options supported by the specific TLS package that is in use, but it 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). so like… don't get your hopes up for other ports 😭

::autoproxy::tls_socket args

This function is to be used to register a proxy-aware secure socket handler for the https protocol. It may only be used with the Tcl http package and should be registered using the http::register command (see the examples below). The job of actually creating the tunnelled connection is done by the tls_connect command, and this may be used when not registering with the http package. teamwork makes the dream work 🫢


πŸŽ€ OPTIONS πŸŽ€

  • -host hostname
  • -proxy_host hostname β€” Set the proxy hostname. This is normally set up by init but may be configured here as well.
  • -port number
  • -proxy_port number β€” Set the proxy port number. This is normally set up by init. e.g. configure -port 3128
  • -no_proxy list β€” You may manipulate the no_proxy list that was setup by init. The value of this option is a tcl list of strings that are matched against the http request host using the tcl string match command. Therefore glob patterns are permitted. For instance, configure -no_proxy *.localdomain
  • -authProc procedure β€” This option may be used to set an application defined procedure to be called when configure -basic is called with either no or insufficient authentication details. This can be used to present a dialog to the user to request the additional information. pop-up asking for the password? very real πŸ’…
  • -basic β€” Following options are for configuring the Basic authentication scheme parameters. See Basic Authentication. To unset the proxy authentication information retained from a previous call of this function either "--" or no additional parameters can be supplied. This will remove the existing authentication information.
  • -tls_package packagename β€” This option may be used to configure the Tcl package to use for TLS support. Valid package names are tls (default) and twapi.

πŸ”₯ BASIC AUTHENTICATION πŸ”₯

Basic is the simplest and most commonly used 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. ⚠️ like, genuinely, it's not private, bestie. 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 exist for this scheme:

  • -username name β€” The username required to authenticate with the configured proxy.
  • -password password β€” The password required for the username specified.
  • -realm realm β€” This option is not used by this package but may be used in requesting authentication details from the user.
  • -- β€” The end-of-options indicator may be used alone to unset any authentication details currently enabled.

🌈 EXAMPLES 🌈

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/]

ate. periodt. ✨


πŸ“š REFERENCES πŸ“š


πŸ’€ BUGS πŸ’€

At this time only Basic authentication (1) (2) is supported. It is planned to add support for Digest (2) and NTLM in the future. so like… manifesting, but for now, Basic only πŸ•―οΈ


🌸 AUTHORS 🌸

Pat Thoyts. thank you for your service, king πŸ‘‘


πŸ’Œ BUGS, IDEAS, FEEDBACK πŸ’Œ

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 Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation. we want the feedback, fr fr 🫢

When proposing code changes, please provide unified diffs, i.e. the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. (left-most button, bestie, don't miss it πŸ’…)


πŸ‘€ SEE ALSO πŸ‘€

http(3tcl)


⭐ KEYWORDS ⭐

authentication, http, proxy


🧚 CATEGORY 🧚

Networking


and that's the whole page, bestie!! this was autoproxy from tcllib version 1.8.1 β€” go forth and proxy responsibly πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from