6

I was wondering if there was a way to use JavaScript to get a httpGet request from a IPv6 address.

I've set up a virtual mesh network using cooja on my home computer, each node has an IPv6 address in the form of aaaa::0212:740x:000x:0x0x where x is the node number.

When using a normal jquery request:

$.ajax({ url: url,
 success: function(data) 
 {console.log(data); } 
});

a website eg http://www.random.org/intergers/?etc, will get a random number back and log it, however when a ipv6 address is put in ie [aaaa::0212:740x:000x:0x0x] it doesnt give me back anything, no errors, no response, nothing.

Can anybody shed some light on this issue?

Daryl Rodrigo
  • 1,387
  • 2
  • 11
  • 19

1 Answers1

2

The correct syntax for a URL containing an IPv6 address is:

http://[2607:f8b0:4005:802::1010]/

The brackets are necessary to distinguish address components from a port number.

  • Thats right, which works when I place it in a web browsers url, but when i place it in an jquery ajax or get request, it doesnt seem to respond, with or without square brackets :/ – Daryl Rodrigo Nov 06 '13 at 10:43
  • @DarylRodrigo Have you tried sniff the request in the browser's developer tools ? – Vitor Canova Nov 06 '13 at 11:12
  • @VitorCanova, I did what you suggested and sniffed the http request to the IPv6. Looks like the IPv6 request is fine, as a response it gives (Status-Line) HTTP/1.0 200 OK except is missing Content-Enconding, Content-length and a whole bunch of other data. Any Ideas? – Daryl Rodrigo Nov 07 '13 at 15:34
  • @DarylRodrigo Have you tried another ipv6 domain for example? – Vitor Canova Nov 07 '13 at 19:21