spdy-http2 / node-spdy

SPDY server on Node.js
2.81k stars 196 forks source link

Mismatch of Handle.prototype.getsockname() compared to NodeJs implementation of socket handles #313

Open Flarna opened 7 years ago

Flarna commented 7 years ago

If I call req.socket.address() on an HTTP2 request I get an empty object as result instead of the socket address. Root cause seems to be that Handle.prototype.getsockname() is providing the result as return value whereas NodeJs interprets the return value as error and requires the result in object passed as first argument. see net.js:

Socket.prototype._getsockname = function() {
  if (!this._handle || !this._handle.getsockname) {
    return {};
  }
  if (!this._sockname) {
    var out = {};
    var err = this._handle.getsockname(out);
    if (err) return {};  // FIXME(bnoordhuis) Throw?
    this._sockname = out;
  }
  return this._sockname;
};