Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP request over IPv6

Tags:

http

header

ipv6

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?

like image 900
ramulu ponnam Avatar asked Oct 20 '25 10:10

ramulu ponnam


1 Answers

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.

like image 179
Lyth Avatar answered Oct 23 '25 09:10

Lyth