浏览器/DNS 处理域中的无效字符?

发布于 2024-09-12 07:59:07 字数 491 浏览 5 评论 0原文

我想知道浏览器和/或 DNS 如何处理用户在域名中输入无效字符。

假设我拥有meat&potatoes,一家著名的高级餐厅连锁店。我们所有的营销活动都将我们称为meat&potatoes(肉+&符号+土豆,没有空格),人们很可能经常输入www.meat&potatoes.com< /strong> 进入他们的浏览器。

浏览器和/或其 ISP 的 DNS 如何处理此请求?有什么方法可以让用户进入正确的域,而不需要他们进行额外的点击/击键?

编辑:在我有限的测试中,我发现 Chrome 会将字符转换为 URL 编码版本(例如 %26 表示 &),然后向某处发送请求,导致我的 ISP( RCN)给我一个搜索结果页面(因为 RCN 就是这样邪恶):www17.searchresults.rcn.com/… 所以,有东西正在到达 ISP。

I'm wondering how the browser, and/or DNS, handles a user entering an invalid character in a domain name.

Let's say that I own meat&potatoes, a well-known chain of fine dining restaurants. All of our marketing refers to us as meat&potatoes (meat + ampersand + potatoes, no spaces), and it's likely that fairly often, people are typing www.meat&potatoes.com into their browser.

How does the browser, and/or their ISP's DNS, handle this request? Are there any ways I can get the user to the correct domain without requiring them to make additional clicks / keystrokes?

Edit: In my limited testing, I've found that Chrome transforms the character into a URL-encoded version (e.g. %26 for &), and then sends a request somewhere that results in my ISP(RCN) giving me a search results page (because RCN is evil like that): www17.searchresults.rcn.com/… So, something is reaching the ISP.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半山落雨半山空 2024-09-19 07:59:07

主机名仅限于字母 (az)、数字 (0-9) 和连字符 (-)(RFC1034 第 3.5 节)。
此外,最近的浏览器使用 puny-encoding (RFC3492) 允许使用国际字符 - 这基本上适用于 127 以上的字符值。

我不知道浏览器具体如何处理这个问题,但我希望它们遵循这两套规则,并向最终用户提供错误/重定向以进行其他操作。

因此它永远不会达到 DNS/ISP 的程度。

不幸的是,这意味着目前无法制作“&”在域名工作中...

Host names are limited (RFC1034 section 3.5) to letters (a-z), numbers (0-9) and hyphen (-).
Additionally, international characters are allowed by recent browsers using puny-encoding (RFC3492) - which basically applies to character values above 127.

I don't know specifically how browsers handle this, but I expect that they go by these two sets of rules, and gives the end-user an error/redirect for anything else.

And therefore it never gets as far as DNS / ISPs.

Unfortunately this means that there is currently no way to make "&" in a domain name work...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文