Reject sockets with no IP

This commit is contained in:
calzoneman 2014-08-20 12:09:38 -05:00
parent 3e53b30305
commit ab49eaab76
1 changed files with 7 additions and 0 deletions

View File

@ -127,6 +127,13 @@ function addTypecheckedFunctions(sock) {
*/
function handleConnection(sock) {
var ip = sock.request.connection.remoteAddress;
if (!ip) {
socket.emit("kick", {
reason: "Your IP address could not be determined from the socket connection. See https://github.com/Automattic/socket.io/issues/1387#issuecomment-48425088 for details"
});
return;
}
if (net.isIPv6(ip)) {
ip = util.expandIPv6(ip);
}