HTTP(S) proxy variables


Proxy Variables
The http and https proxies can be configured per request, or with Factor's dynamic variables, or with the system's environment variables (searched from left to right) :
variableFactor dynamicenvironment #1environment #2
HTTP"http.proxy"http_proxyHTTP_PROXY
HTTPS"https.proxy"https_proxyHTTPS_PROXY
no proxy"no_proxy"no_proxyNO_PROXY

When making an http request, if the target host is not matched by the no_proxy list, the http.client will fill the missing components of the proxy-url slot of the request from the value of these variables. If the filled result is not valid, an error is thrown.

Notes
The dynamic variables are keyed by strings. This allows to use Factor's command line support to define them (see in the examples below).

no_proxy
The no_proxy list must be a string containing of comma-separated list of IP addresses (eg 127.0.0.1), hostnames (eg bar.private) or domain suffixes (eg .private). A match happens when a value of the list is the same or a suffix of the target for each full subdomain.
USING: http.client http.client.private namespaces prettyprint ; "bar.private" "no_proxy" [ "bar.private" <get-request> no-proxy? . ] with-variable "bar.private" "no_proxy" [ "baz.bar.private" <get-request> no-proxy? . ] with-variable "bar.private" "no_proxy" [ "foobar.private" <get-request> no-proxy? . ] with-variable ".private" "no_proxy" [ "foobar.private" <get-request> no-proxy? . ] with-variable
t t f t


Examples

At factor startup:
$ ./factor -http.proxy=http://localhost:3128
$ http_proxy="http://localhost:3128" ./factor
$ HTTP_PROXY="http://localhost:3128" ./factor


Using variables:
USE: namespaces "http://localhost:3128" "http.proxy" set ! or set-global

USE: namespaces "http://localhost:3128" "http.proxy" [ ] with-variable


Manually making the request:
USING: http http.client urls ; URL" http://localhost:3128" <request> proxy-url<<


Full example:
$ no_proxy="localhost,127.0.0.1,.private" http_proxy="http://proxy.private:3128" https_proxy="http://proxysec.private:3128" ./factor