问题描述
我想知道使用从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字段:
因此,您应该将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:
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请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!