special characters in http_proxy environment variable

JAR asked:

What is the correct format using special characters in http_proxy environment variable?
Or to be mor specific, what to do with special characters in username or password when authenticate to http proxy on the command line.

My answer:

Suppose your username is foo and your password is bar$.

Quote them:

http_proxy='http://foo:[email protected]:3128/' wget http://www.google.com/

Or escape them:

http_proxy=http://foo:bar\[email protected]:3128/ wget http://www.google.com/

What if your password is bar/? URL encode them.

http_proxy="http://foo:bar%[email protected]:3128/" wget http://www.google.com/

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.