improved extraction of properties from TLS sockets
This commit is contained in:
parent
2b70001309
commit
caa7b343d4
|
@ -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 || '';
|
||||
|
|
Loading…
Reference in New Issue