bash Curl - 用户身份验证/密码中的感叹号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11444347/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Curl - Exclamation mark in User Auth/Password
提问by MichaelICE
Having a problem with CURL and the HTTP User and password Auth methods, it is not liking the exclamation mark, I've tried escaping the following ways:
CURL 和 HTTP 用户和密码 Auth 方法有问题,它不喜欢感叹号,我尝试通过以下方式转义:
Tried and failed...
尝试过,失败了...
/usr/bin/curl -u 'UserName\WithSlash:PasswordWithExclamation!' https://test.com/
/usr/bin/curl -u UserName\WithSlash:PasswordWithExclamation\! https://test.com/
Not working for basic or digest if it matters (using --anyauth) ... getting 401 denied...
如果重要,则不适用于基本或摘要(使用 --anyauth)... 401 被拒绝...
What am I doing incorrectly?
我做错了什么?
回答by pizza
curl -u UserName\WithSlash:PasswordWithExclamation\! http://....
works fine.
工作正常。
it sends
它发送
GET / HTTP/1.1
Authorization: Basic VXNlck5hbWVcV2l0aFNsYXNoOlBhc3N3b3JkV2l0aEV4Y2xhbWF0aW9uIQ==
User-Agent: curl/7.21.0
Host: teststuff1.com:80
Accept: */*
which is "UserName\WithSlash:PasswordWithExclamation!" in the auth string.
这是“UserName\WithSlash:PasswordWithExclamation!” 在身份验证字符串中。