gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:11:59 24 4
gpt4 key购买 nike

我有一个 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.comhttp://google.com

最佳答案

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

... 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

The reg-name syntax allows percent-encoded octets in order torepresent non-ASCII registered names in a uniform way that isindependent of the underlying name resolution technology. Non-ASCIIcharacters must first be encoded according to UTF-8 [STD63], and theneach octet of the corresponding UTF-8 sequence must be percent-encoded to be represented as URI characters. URI producingapplications must not use percent-encoding in host unless it is usedto represent a UTF-8 character sequence.

因此 Firefox 不重定向您是完全正确的。 %67oogle.com 是 URL 的无效主机部分。

关于http - 为什么 FireFox 不将 http ://%67oogle. com 指向 http ://google. com?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11320982/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com