Suppose you are in a corporate network environment and often times find yourself manually setting/unsetting the HTTP_PROXY environment variable in order to access different hosts (for instance, yay proxy for the external hosts and nay proxy for the internal ones). Sounds familiar? In this case, a tool called depac might help you.
if/else if/else clause that maps the requested hostname to the address of the proxy host capable of contacting the requested hostname.
parse the PAC file. Then, it creates a relay proxy that forwards the requests to the routes assigned by the PAC logic.
depac is usually started in the beginning of login session, and through use of environment variables it's relay proxy can be located and automatically used for all the user agents that do support HTTP_PROXY variables.
(this technique is somewhat similar to what ssh-agent does. In fact, half of the previous paragraph was stolen from
ssh-agent manual page :)
The biggest advantage of
$ curl -o ~/bin/depac https://raw.githubusercontent.com/creaktive/dePAC/master/depac
$ chmod +x ~/bin/depac
$ echo 'eval $(~/bin/depac)' >> ~/.profile
Or you can use
wget and call it with
perl (feel free to mix):
$ wget -O ~/depac https://raw.githubusercontent.com/creaktive/dePAC/master/depac
$ echo 'eval $(perl ~/depac)' >> ~/.profile
You can also use
depac in an ad-hoc fashion, without a shared instance running in the background:
$ depac -- wget -r -np https://something.com