get the correct remoteAddress if possible

This commit is contained in:
AJ ONeal 2017-04-28 13:11:12 -06:00
parent eacf2e0dbf
commit aed520a653
1 changed files with 5 additions and 2 deletions

View File

@ -359,8 +359,10 @@ module.exports.create = function (deps, config) {
try { try {
reader._remoteAddress = wrapOpts.remoteAddress; reader._remoteAddress = wrapOpts.remoteAddress;
reader._remotePort = wrapOpts.remotePort; reader._remotePort = wrapOpts.remotePort;
reader._remoteFamily = wrapOpts.remoteFamily;
reader._localAddress = wrapOpts.localAddress; reader._localAddress = wrapOpts.localAddress;
reader._localPort = wrapOpts.localPort; reader._localPort = wrapOpts.localPort;
reader._localFamily = wrapOpts.localFamily;
} catch(e) { } catch(e) {
} }
@ -440,8 +442,9 @@ module.exports.create = function (deps, config) {
servername: tlsSocket.servername servername: tlsSocket.servername
, encrypted: true , encrypted: true
// remoteAddress... ugh... https://github.com/nodejs/node/issues/8854 // remoteAddress... ugh... https://github.com/nodejs/node/issues/8854
, remoteAddress: tlsSocket.remoteAddress || tlsSocket._handle._parent.owner.stream.remoteAddress , remoteAddress: tlsSocket.remoteAddress || tlsSocket._remoteAddress || tlsSocket._handle._parent.owner.stream.remoteAddress
, remotePort: tlsSocket.remotePort || tlsSocket._handle._parent.owner.stream.remotePort , remotePort: tlsSocket.remotePort || tlsSocket._remotePort || tlsSocket._handle._parent.owner.stream.remotePort
, remoteFamily: tlsSocket.remoteFamily || tlsSocket._remoteFamily || tlsSocket._handle._parent.owner.stream.remoteFamily
}); });
}); });