开发者

HTTP request over IPv6

I want to know the difference between the he开发者_StackOverflowader format of HTTP GET request that uses from IPv4 server to IPv6 server?

Now, currently I am using the following format:

"GET /"+myFileToDownLoad+" HTTP/1.1\r\n"+
            "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*\r\n"
            +"Referer: http://"+myDstIp+"/\r\n"
            +"Accept-Language: he\r\n"
            +"Accept-Encoding: gzip, deflate\r\n"
            +"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n"
            //+"Host: "+myDstIp+"\r\n"
            +"Host: "+((myHost==null)?myDstIp:myHost)+"\r\n"
            +"Connection: Close\r\n\r\n";

So, if i want to use the IPv6 server, is it necessary to change the format?


RFC 2732 updates the Host field:

The following changes to the syntax in RFC 2396 are made: (1) change the 'host' non-terminal to add an IPv6 option:

  host          = hostname | IPv4address | IPv6reference
  ipv6reference = "[" IPv6address "]"

where IPv6address is defined as in RFC2373 [ARCH].

So you should enclose IPv6 address in square brackets.

Update: The change applies to URLs with host part in IPv6 format and propagates to all request fields that use 'host' part from the original address - in your example these are Host and Referrer. That is, you'll have to add square brackets around myDstIp in Referrer and Host fields.


RFC2396 Uniform Resource Identifiers (URI): Generic Syntax was updated by RFC2732 Format for Literal IPv6 Addresses in URL's.

Specifically, section 3 in RFC2732.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜