通过IPv6的HTTP请求 [英] HTTP request over IPv6

查看:2299
本文介绍了通过IPv6的HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道使用从IPv4服务器到IPv6服务器的HTTP GET 请求的头格式之间的区别吗?



现在,我正在使用以下格式:

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

+Referer:http://+ myDstIp +/ \\\
+Accept -Language:he \r\\\

+Accept-Encoding:gzip,deflate \r\\\

+User-Agent:Mozilla / 4.0(compatible; MSIE 6.0; Windows NT 5.0)\r\\\

// +Host:+ myDstIp +\r\\\

+Host:+((myHost == null)? myDstIp:myHost)+\r\\\

+Connection:Close \r\\\
\r\\\
;

所以,如果我想使用IPv6服务器,是否需要更改格式?

解决方案

RFC 2732更新Host字段:


在RFC 2396中对语法进行了以下更改:(1)
更改'主机'非终端以添加IPv6选项:

  host = hostname | IPv4地址| IPv6参考
ipv6reference =[IPv6address]

其中IPv6address的定义与RFC2373


因此,您应该将IPv6地址放在方括号中。



<更新:
更改适用于主机部分采用IPv6格式的URL并传播到所有使用原始地址中的'主机'部分的请求字段 - 在您的示例中,这些是主机和推荐人。
也就是说,您必须在 Referrer 和<$ c $>中围绕 myDstIp 添加方括号c>主机字段。


I want to know the difference between the header 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.

这篇关于通过IPv6的HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆