Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
What do you mean by "special characters"? –  John Gardeniers Feb 15 '13 at 12:39
add comment

2 Answers

up vote 1 down vote accepted

At first, the complete format is:

http_proxy='http://user:pass@server:port/'

Every special character in username and password must not conflict with the characters used in the above format AND must be URL compliant.

Here is an example:

Domain: ADMIN DOM
User:   my@email.address  
PW:     a%b(c/x@y z
Server: proxy.server.at
Port:   8080

becomes:

'http://ADMIN%20DOM\my%40email.address:a%25b(c%2Fx%40y%20z@proxy.server.at:8080/'

And to prevent bash interpretation of any character always use single-quotes.

You can set this system wide in /etc/environment like this:

http_proxy='http://ADMIN%20DOM\my%40email.address:a%25b(c%2Fx%40y%20z@proxy.server.at:8080/'

Easy URL encoding/decoding:
https://duckduckgo.com/?q=url+encode+a%25b%28c%2Fx%40y+z&kl=at-de
or
https://duckduckgo.com/?q=url+escaping

share|improve this answer
add comment

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

Quote them:

http_proxy='http://foo:bar$@localhost:3128/' wget http://www.google.com/

Or escape them:

http_proxy=http://foo:bar\$@localhost:3128/ wget http://www.google.com/

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

http_proxy="http://foo:bar%2F@localhost:3128/" wget http://www.google.com/
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.