IE7 support IPv6
Starting with with IE7 and above, WinINet supports IPv6 literals in the hostname, and the authority component of the URI. WinINet also supports the use of IPv6 literals in relevant portions of the HTTP protocol, such as in the Location header.
Hostname IPv6 Literals and URI Components
WinINet implements IPv6 literals according to the specifications in RFC 3513. As specified in this RFC, IPv6 literals in a URI must be enclosed in brackets. For example, http://[::1]/ is a valid IPv6 URI; the form without brackets (http://::1/) is not valid. Hostname IPv6 literals that are not part of the URI, however, do not need to be enclosed in the brackets; either form is acceptable to WinINet. For example, both "::1" and "[::1]" are acceptable forms of IPv6 hostname literals. Other APIs, such as the WinSock API, will also accept both forms. Thus applications should be prepared to handle both forms of IPv6 hostname literals.
Scope ID
The IPv6 literal address in the URI may include a scope ID. A scope ID can be an interface ID such as [FE80::1%1]. The URI standard, documented in RFC 3986, does not define the syntax for the scope ID, and the URI is considered non-uniform when the scope ID is present. However, WinINet accepts a scope ID in the authority component of the URI, and in the hostname IPv6 literal.
The percent character (%) in the IPv6 literal address must be percent escaped when present in the URI. For example, the scope ID FE80::2%3, must appear in the URI as "http://[FE80::2%253]/", where %25 is the hex encoded percent character (%). If the application retrieves the URI from a Unicode API, such as the Winsock WSAAddressToString API, the application must add the escaped version of the percent character (%) in the hostname of the URI. To create the escaped version of the URI, applications call InternetCreateUrl with the dwFlags parameter set to ICU_ESCAPE_AUTHORITY, and the IPv6 hostname specified in the URL components structure specified in the lpUrlComponents parameter.
For all sockets operations, WinINet uses the scope ID. However, because the scope ID has only local host significance, it is not sent as part of the HTTP protocol headers in the request. For example, the call to InternetOpenUrl is called with the following URL in the lpszUrl parameter.
http://[fec0::2%251]:80/path.htm
The scope ID portion of the URL is removed by WinINet when the HTTP request is sent for this URL. The request contains the following headers:
GET path.htm HTTP/1.1
Host: [fec0::2]
IPv6 URIs in IE7
One of the benefits of creating a new URI parsing API for IE7 was that we were able to more easily add support for IPv6 addresses in URIs throughout IE7. This blog post will describe the use of IPv6 URIs in IE7.
IPv6 Syntax
One of the advantages of IPv6 over IPv4 is that IPv6 addresses are four times longer than IPv4 addresses (128 bits vs. 32 bits) allowing for about 3.402 * 1038 unique IPv6 addresses. Due to the longer length, a new and more compact textual representation is used for IPv6 addresses. IPv6 addresses are written as groups of four hexadecimal digits delimited by colons. For the full details on IPv6 addresses and their textual representation, see the IPv6 Addressing standard. The following is an example of an IPv6 address:
fec0::abcd
The old URI syntax and the IPv6 address syntax conflicted so in accommodation, the URI syntax was modified. According to the latest URI standard, when you put an IPv6 address in the host, you must enclose it in square brackets. Thus, the previous example IPv6 address could appear as follows in a URI:
http://[fec0::abcd]/
URIs containing IPv6 addresses are not considered “special” in IE and they may be used anywhere IE accepts or displays a URI.
Scope-IDs
One explicit omission from the latest URI standard concerning IPv6 addresses is IPv6 scope-ids. IPv6 scope-ids specify which zone (a group of network connections) on a computer should be used when resolving a particular IPv6 address. See the IPv6 Scoped Address Architecture proposed standard for a full description of scope-ids. The scope-id appears after the IPv6 address delimited by a percent character. The previous IPv6 address example with a scope-id of 1 looks like this:
fec0::abcd%1
Non-encoded percents are not permitted in URIs, so in order to support scope-ids in IPv6 URIs, IE7 allows scope-ids following the IPv6 address when delimited by a percent-encoded percent character. Therefore, the previous example IPv6 address could appear in a URI in IE7 as follows:
http://[fec0::abcd%251]/
There is currently an IETF document describing an update to the URI standard to include scope-ids, however this is still in draft stage and so is not supported by IE7. MSDN has more details on IE7’s support for IPv6 scope-ids in URIs.
Trying It Out
If you’re interested in trying this out yourself with your own web server, but aren’t connected to an IPv6 network, you can enable the IPv6 stack in Windows, and open the URI http://[::1]/ in IE7. The IPv6 address ::1 is the loopback address, similar to the IPv4 address 127.0.0.1. This will allow you to connect to your own computer’s web server via an IPv6 address.
Conclusion
I’ve described the use of and syntax of IPv6 URIs in IE7 at a high level, but if you’re interested in the nitty-gritty details, check out the provided links to documents that describe IPv6 addressing and URIs in greater detail and try out IPv6 URIs on your own. Additionally, I should mention that although support for IPv6 URIs is new to IE7 and not available in IE6, IE6 does support DNS names backed by IPv6 addresses. Please leave me any IPv6 URI related comments or questions.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>IPv6地址类型
在RFC1884中指出了三种类型的IPv6地址,他们分别占用不同的地址空间:
- 单点传送:这种类型的地址是单个接口的地址。发送到一个单点传送地址的信息包只会送到地址为这个地址的接口。
- 任意点传送:这种类型的地址是一组接口的地址,发送到一个任意点传送地址的信息包只会发送到这组地址中的一个(根据路由距离的远近来选择)
- 多点传送:这种类型的地址是一组接口的地址,发送到一个多点传送地址的信息包会发送到属于这个组的全部接口。
IPv6地址表示
我们知道,IPv4地址长度为32位(4个字节)。书写IPv4的地址是用一个字节来代表一个无符号十进制整数,四个字节写成由3个点分开的四个十进制数,例如:
10.1.123.56
对于128位的IPv6地址,定义相似的表示方法是必要的。 考虑到IPv6地址的长度是原来的四倍,RFC1884规定的标准语法建议把IPv6地址的128位(16个字节)写成8个16位的无符号整数,每个整数用四个十六进制位表示,这些数之间用冒号(:)分开,例如:
3ffe:3201:1401:1:280:c8ff:fe4d:db39
从上面的例子我们看到了手工管理IPv6地址的难度,也看到了DHCP和DNS的必要性。为了进一步简化IPv6的地址表示,可以用0来表示0000,用1来表示0001,用20来表示0020, 用300来表示0300,只要保证数值不便,就可以将前面的0省略。比如:
.
1080:0000:0000:0000:0008:0800:200C:417A
0000:0000:0000:0000:0000:0000:0A00:0001
可以简写为:
1080:0:0:0:8:800:200C:417A
0:0:0:0:0:0:A00:1
另外,还规定可以用符号::表示一系列的0。那么上面的地址又可以简化为:
1080::0:8:800:200C:417A
::A00:1
IPv6地址的前缀(FP, Format Prefix)的表示和IPv4地址前缀在CIDR中的表示方法类似。比如 0020:0250:f002::/48表示一个前缀为48位的网络地址空间。
IPv6地址分配
RFC1881规定, IPv6地址空间的管理必须符合Internet团体的利益,必须是通过一个中心权威机构来分配。目前这个权威机构就是IANA(Internet Assigned Numbers Authority,Internet分配号码权威机构)。 IANA会根据IAB(Internet Architecture Board)和IEGS的建议来进行IPv6地址的分配.
目前IANA已经委派三个地方组织来执行IPv6地址分配的任务:
- 欧洲的RIPE-NCC (www.ripe.net)
- 北美的INTERNIC (www.internic.net)
- 亚太平洋地区的APNIC(www.apnic.net)