Handle case where remoteAddress is not yet avail
This commit is contained in:
@@ -598,6 +598,10 @@ Client.prototype.isLocal = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Client.prototype.friendlyRemoteAddress = function () {
|
Client.prototype.friendlyRemoteAddress = function () {
|
||||||
|
if (!this.remoteAddress) {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
|
||||||
// convert any :ffff: IPv4's to 32bit version
|
// convert any :ffff: IPv4's to 32bit version
|
||||||
return this.remoteAddress.replace(/^::ffff:/, '').replace(/^::1$/, 'localhost');
|
return this.remoteAddress.replace(/^::ffff:/, '').replace(/^::1$/, 'localhost');
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user