为什么FireFox没有将http://%67oogle.com指向http://google.com?

时间:2012-07-04 00:29:16

标签: http url

我有一个HTML文件 test.html

<a href="http://%67oogle.com">http://%67oogle.com</a>
<br>
<a href="http://www.%67oogle.com">http://www.%67oogle.com</a>

这些链接适用于Chrome,IExplorer,Safari和Opera(http://%67oogle.com指向http://google.com)。

但是,链接不适用于FireFox(v13.0.1)。

为什么FireFox没有将http://%67oogle.com指向http://google.com

1 个答案:

答案 0 :(得分:1)

有效的HTTP URI是符合HTTP {1.1标准RFC 2616的HTTP URI。它说:

... For definitive information on
URL syntax and semantics, see "Uniform Resource Identifiers (URI):
Generic Syntax and Semantics," RFC 2396 [42] (which replaces RFCs
1738 [4] and RFC 1808 [11]). This specification adopts the
definitions of "URI-reference", "absoluteURI", "relativeURI", "port",
"host","abs_path", "rel_path", and "authority" from that
specification.

The "http" scheme is used to locate network resources via the HTTP
protocol. This section defines the scheme-specific syntax and
semantics for http URLs.

http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]

如果我们深入研究RFC 2396,则会将host定义为:

  host          = hostname | IPv4address
  hostname      = *( domainlabel "." ) toplabel [ "." ]
  domainlabel   = alphanum | alphanum *( alphanum | "-" ) alphanum
  toplabel      = alpha | alpha *( alphanum | "-" ) alphanum

让我们看一下RFC 3986

  

reg-name语法允许百分比编码的八位字节   以统一的方式表示非ASCII注册名称   独立于基础名称解析技术。非ASCII   首先必须根据UTF-8 [STD63]对字符进行编码   相应的UTF-8序列的每个八位字节必须是百分比 -   编码为URI字符。 URI生成   除非使用,否则应用程序不得在主机中使用百分比编码   表示UTF-8字符序列。

所以Firefox完全不对你进行重定向。 %67oogle.com是网址的无效主机部分。