You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Should we instead set options.host to 'localhost' and fall through so that both use cases (host set in options or not) resolve to the same IP address?
There are other places where it seems IPv4 addresses are assumed:
In Socket.prototype.listen, when no IP is passed, IPv4 is hardcoded:
} else if (util.isUndefined(arguments[1]) ||
util.isFunction(arguments[1]) ||
util.isNumber(arguments[1])) {
// The first argument is the port, no IP given.
listen(self, null, port, 4, backlog);
There's another case in Socket.prototype.connect when we hard-code IPv4, I'm not sure what use case it covers:
} else {
timers._unrefActive(self);
addressType = addressType || 4;
// node_net.cc handles null host names graciously but user land
// expects remoteAddress to have a meaningful value
ip = ip || (addressType === 4 ? '127.0.0.1' : '0:0:0:0:0:0:0:1');
connect(self,
ip,
options.port,
addressType,
options.localAddress,
options.localPort);
}
Socket.prototype.connect() sometimes throws on bad inputs
after an asynchronous operation. This commit makes the input
validation synchronous. This commit also removes some hard
coded IP addresses.
PR-URL: #8180Fixes: #8140
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
It seems that Socket.prototype.connect assumes an IPv4 localhost address when no host is given. Here's the code in
lib/net.js
:Should we instead set options.host to 'localhost' and fall through so that both use cases (host set in options or not) resolve to the same IP address?
There are other places where it seems IPv4 addresses are assumed:
Socket.prototype.listen
, when no IP is passed, IPv4 is hardcoded:/cc @cjihrig
The text was updated successfully, but these errors were encountered: