Merge branch 'pr/1756' into develop

Conflicts:
	src/node/handler/SocketIORouter.js
This commit is contained in:
Marcel Klehr 2013-09-29 16:45:12 +02:00
commit 7b17bd58ae
4 changed files with 22 additions and 3 deletions

View file

@ -23,6 +23,7 @@ var ERR = require("async-stacktrace");
var log4js = require('log4js');
var messageLogger = log4js.getLogger("message");
var securityManager = require("../db/SecurityManager");
var settings = require('../utils/Settings');
/**
* Saves all components
@ -52,8 +53,14 @@ exports.setSocketIO = function(_socket) {
//save this socket internaly
socket = _socket;
socket.sockets.on('connection', function(client) {
client.set('remoteAddress', client.handshake.address.address);
socket.sockets.on('connection', function(client)
{
if(settings.trustProxy && client.handshake.headers['x-forwarded-for'] !== undefined){
client.set('remoteAddress', client.handshake.headers['x-forwarded-for']);
}
else{
client.set('remoteAddress', client.handshake.address.address);
}
var clientAuthorized = false;
//wrap the original send function to log the messages