在基本身份验证 URL 中转义用户名字符
使用http基本身份验证时,可以在URL中传递用户名,例如
http://[email protected]/path/
但现在假设用户名是电子邮件地址,例如 [电子邮件受保护]。这样做显然是不明确的:
http://[email protected]@foo.com/path/
有没有办法转义用户名中的@字符?我尝试了标准 URL 编码:
http://david%[email protected]/path/
但这并没有成功。
When using http basic authentication, the username can be passed in the URL, e.g.
http://[email protected]/path/
But now suppose the username is an email address, e.g. [email protected]. Doing this is clearly ambiguous:
http://[email protected]@foo.com/path/
Is there a way to escape the @ character in the username? I tried standard URL encoding:
http://david%[email protected]/path/
But that didn't do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 RFC 3986,第 3.2.1 节,它需要进行百分比编码:
所以它看起来
是正确的。你想在哪里阅读它?也许您需要手动解码该值?
According to RFC 3986, section 3.2.1, it needs to be percent encoded:
So it looks like
Is right. Where are you trying to read it? Maybe you need to manually decode the value?