title: Node: Can't bind to IPv6 localAddress while using https.request()
body: <p>I can bind to <strong><code>localAddress</code></strong> just fine when using HTTP, but as soon as I switch to HTTPS I get an  error: <strong><code>bind EINVAL</code></strong>. Please consider this code:</p>
  
  <pre><code>var http = require('http');
  var https = require('https');
  var options = { host:'icanhazip.com',path:'/',localAddress:'2604:a880:1:20::27:a00f',family:6 };
  callback = function(response) {
    var data = '';
    response.on('data',function(chunk) { data+= chunk; });
    response.on('error',function(error) { console.log("error: "+error.message); });
    response.on('end',function() {
      console.log(data);
    });
  }
  http.request(options,callback).end(); // Works. IP:2604:a880:1:20::27:a00f
  https.request(options,callback).end(); // Fails. IP:2604:a880:1:20::27:a00f
  https.request({host:'icanhazip.com',path:'/',family:6},callback).end(); // Works. IP:2604:a880:1:20::27:a00f
  </code></pre>
  
  <p>Here's the error while running node v5.0.0:</p>
  
  <pre><code>Error: bind EINVAL 2604:a880:1:20::27:a00f
      at Object.exports._errnoException (util.js:860:11)
      at exports._exceptionWithHostPort (util.js:883:20)
      at connect (net.js:809:16)
      at net.js:984:7
      at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:63:16)
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:82:10)
  </code></pre>
  
  <p>The only difference between the working and the failing code is setting <strong><code>localAddress</code></strong> and ironically, the last example binds to the correct IP address, but won't let you do it using <strong><code>localAddress</code></strong>.</p>
  
  <p>The problem here is I have to make a request from a completely separate IPv6 address under my use case, and it works fine with HTTP but I need this to work for HTTPS requests. Currently I can only make this work while using cURL. Could you please provide some insight as to why this is happening or how I could make this work without additional libraries?</p>