3

I know in unix/linux the enviroment variables are uppercase, like LD_LIBRARY_PATH ; HOME ; $USER and so on. Today playing with wget I saw this commands just uses lowercase enviroment variables:

env | grep -i proxy
http_proxy=http://10.0.0.120:8080
wget -q http://google.it
echo $?
0
unset http_proxy
export HTTP_PROXY=http://10.0.0.120:8080
wget -q http://google.it
echo $?
1

Why wget doesn't read HTTP_PROXY in uppercase format?

peterh
  • 4,953
  • 13
  • 30
  • 44
c4f4t0r
  • 5,301
  • 3
  • 31
  • 42

3 Answers3

4

This is just a guess, but project timelines would suggest that it's for backwards compatibility with Lynx, which predates curl by a few years (and which uses lower-case proxy variables).

Gerald Combs
  • 6,441
  • 25
  • 35
4

Short answer: Unfortunately, different programs use different env variables.

Long answer, from (https://wiki.archlinux.org/index.php/proxy_settings#Environment_variables):

Some programs (like wget) use environment variables of the form "protocol_proxy" to determine the proxy for a given protocol. (...) Some programs look for the all caps version of the environment variables.

In the past, I've made a simple script that sets both versions (all caps and "regular" versions to toggle them on and off easily, and it seems that that is a common way of doing things if it must be done via env variables.

c4urself
  • 5,530
  • 3
  • 28
  • 39
1

Unix is case sensitive. Which means that $http_proxy and $HTTP_PROXY are two different variables.

Look at this:

user@foo[~]+ xx=2
user@foo[~]+ echo $xx
2
user@foo[~]+ echo $XX

user@foo[~]+