Using a proxy with the MapDownloaderscript
Recently, there was a discussion in the Windows Mapdownloaderthread about "how to get your script work over a proxy connection".
For Linux there are various possibilities to do so, with different consequences.
Please consider the following options.
1. Add extra "proxy" parameters to the wget function (inside the MapDownloadscript)
Pros: all wget requests are pointed to a proxy
Cons: You will have to adjust the script at several lines. You will have to change these params with every new version of the script.
Conclusion: A cumbersome solution for using a proxy.
2. Set wget configuration to use proxy (outside the MapDownloadscript)
When executed, wget searches for a config file called .wgetrc and takes all parameters from there.
If it is not already there, create a .wgetrc file. wget will find this file automatically.
Add the proxy parameters to the .wgetrc like this:
# You can set the default proxies for Wget to use for http and ftp.
# They will override the value in the environment.
http_proxy = [Only registered and activated users can see links. ]
# If you do not want to use proxy at all, set this to off.
use_proxy = on
pros: All http requests by wget are directed to the proxy. Configuration of all wget params are set from one place outside the script.
cons: All http requests by any wget instances are directed to the proxy (which may be unwanted). Your browser is not aware of a proxy, unless you adjust your browser settings.
3. Direct all http(s) traffic from you hosts' shellenvironment to a proxyserver.
Set the system variable for http_proxy as root (system wide) or as a user.
To set the http_proxy variable you will have to assign a value to it like this:
To make this work on all new shells you must export it, and make it a global variable:
http_proxy=http://myproxy.domain.com:8080; export http_proxy
Putting this in the ~/.bashrc file it is only going to work for the user who's home directory the .bashrc file resides in.
To make this a system wide variable for all users place it in the /etc/bashrc file,
echo "http_proxy=http://myproxy.domain.com:8080; export http_proxy" >> /etc/bashrc or on Redhat-like systems in /etc/profile.d/proxy.
Now if you request a resource from the internet with any http-client on the command line it will work fine.
pros: http-requests from every script using wget, curl etc. or apps like Elinks, Links and Lynx are directed to the proxy without having to tell them explicitly.
cons: Every http-request from the shellenvironment is directed to the proxy, which may be unwanted.