improved extraction of properties from TLS sockets

This commit is contained in:
tigerbot 2017-06-21 17:00:46 -06:00
parent 2b70001309
commit caa7b343d4
1 changed files with 5 additions and 1 deletions

View File

@ -9,14 +9,18 @@ module.exports.create = function (deps, config, netHandler) {
function extractSocketProp(socket, propName) {
// remoteAddress, remotePort... ugh... https://github.com/nodejs/node/issues/8854
var value = socket[propName] || socket['_' + propName];
var altName = '_' + propName;
var value = socket[propName] || socket[altName];
try {
value = value || socket._handle._parent.owner.stream[propName];
value = value || socket._handle._parent.owner.stream[altName];
} catch (e) {}
try {
value = value || socket._handle._parentWrap[propName];
value = value || socket._handle._parentWrap[altName];
value = value || socket._handle._parentWrap._handle.owner.stream[propName];
value = value || socket._handle._parentWrap._handle.owner.stream[altName];
} catch (e) {}
return value || '';