什么是在http_proxy环境variables中使用特殊字符的正确格式?
或者是mor特定的,在命令行对http代理进行身份validation时,如何处理用户名或密码中的特殊字符。
起初,完整的格式是:
http_proxy='http://user:pass@server:port/'
用户名和密码中的每个特殊字符都不得与上述格式中使用的字符冲突,并且必须符合URL。
这里是一个例子:
Domain: ADMIN DOM User: [email protected] PW: a%b(c/x@yz Server: proxy.server.at Port: 8080
变为:
'http://ADMIN%20DOM\my%40email.address:a%25b(c%2Fx%40y%[email protected]:8080/'
而为了防止任何字符的bash解释总是使用单引号。
你可以在/ etc / environment中像这样设置这个系统:
http_proxy='http://ADMIN%20DOM\my%40email.address:a%25b(c%2Fx%40y%[email protected]:8080/'
简单的URL编码/解码:
https://duckduckgo.com/?q=url+encode+a%25b%28c%2Fx%40y+z&kl=at-de
要么
https://duckduckgo.com/?q=url+escaping
假设你的用户名是foo ,你的密码是bar$ 。
引用他们:
http_proxy='http://foo:bar$@localhost:3128/' wget http://www.google.com/
或者逃脱他们:
http_proxy=http://foo:bar\$@localhost:3128/ wget http://www.google.com/
如果你的密码是bar/ ? URL编码。
http_proxy="http://foo:bar%2F@localhost:3128/" wget http://www.google.com/