A little further digging shows that this issue is only present on hosts 
that resolve to both ipv4 and ipv6 addresses. Behaviour is as expected on 
addresses that are exclusively ipv6.

I'm guessing this is something to do with the default dns resolve order 
being ipv4 > ipv6, instead the order should be based on whether the local 
bind address is ipv4 or ipv6.

I've attempted a dns.resolve6() on the host prior to the http.request() but 
no dice.



On Tuesday, 26 June 2012 19:48:26 UTC+1, Dmitry Pushkin wrote:
>
> I will investigate this issue.
>
> 2012/6/26 Backspace <b4c5...@gmail.com <javascript:>>
>
>> Yes, the connection is ok
>>
>> wget -qO- http://www.whatismyipv6.com--bind-address=2a01:xxxx:xxxx:xxxx::2 i 
>> returns
>>
>> <head>
>> <title>WhatIsMyIPv6? (IPv6:  2a01:xxxx:xxxx:xxxx::2 )</title>
>> <meta name="bitly-verification" content="984886d337a6"/>
>> </head>
>>
>>
>> On Tuesday, June 26, 2012 3:55:52 PM UTC+2, Ben Noordhuis wrote:
>>>
>>> On Tue, Jun 26, 2012 at 11:41 AM, Backspace 
>>> <b4c5...@gmail.com<javascript:>> 
>>> wrote: 
>>> > I just created this simple program in nodejs, but i can't bind it to 
>>> the 
>>> > ipv6 address of my NIC. 
>>> > 
>>> > I read in the API docs the following: localAddress: Local interface to 
>>> bind 
>>> > for network connections. 
>>> > 
>>> > //------------------------ PROGRAM START ------------------ 
>>> > 
>>> > var http = require('http'); 
>>> > 
>>> > var options = { 
>>> > hostname: 'www.whatismyipv6.com', 
>>> > localAddress: '2a01:xxxx:xxxx:xxxx::2' //a real ipv6 address here 
>>> > }; 
>>> > 
>>> > var req = http.request(options, function(res) { 
>>> > res.on('data', function (chunk) { 
>>> > console.log(chunk.toString()); 
>>> > }); 
>>> > }); 
>>> > 
>>> > req.on('error', function(e) { 
>>> > console.log('ERROR: ' + e.message); 
>>> > }); 
>>> > 
>>> > req.end(); 
>>> > 
>>> > //------------------------ PROGRAM END ------------------ 
>>> > 
>>> > But when i execute the program i get this (no errors are raised). Note 
>>> the 
>>> > ipv4 address. 
>>> > 
>>> > <head> 
>>> > <title>WhatIsMyIPv6? (IPv4: xx.xx.xxx.xxx)</title> 
>>> > <meta name="bitly-verification" content="984886d337a6"/> 
>>> > </head> 
>>> > 
>>> > 
>>> > It looks like nodejs is ignoring the localAddress and is binding 
>>> directly to 
>>> > the ipv4 address. 
>>> > 
>>> > # node --version 
>>> > v0.8.0 
>>>
>>> Is there end-to-end IPv6 connectivity from your machine to 
>>> www.whatismyipv6.com? 
>>>
>>  -- 
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines: 
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to nod...@googlegroups.com<javascript:>
>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to