Skip to content

Commit 65b8272

Browse files
committed
Merge branch 'master' of github.com:LearnBoost/socket.io
2 parents ca3f337 + b2ffed8 commit 65b8272

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

lib/manager.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,21 @@ Manager.prototype.handleHandshake = function (data, req, res) {
805805
*/
806806

807807
Manager.prototype.handshakeData = function (data) {
808-
var connectionAddress = null;
809-
if (data.request.connection.address) {
810-
connectionAddress = data.request.connection.address();
808+
var connection = data.request.connection
809+
, connectionAddress;
810+
811+
if (connection.remoteAddress) {
812+
connectionAddress = {
813+
address: connection.remoteAddress
814+
, port: connection.remotePort
815+
};
816+
} else if (connection.socket && connection.socket.remoteAddress) {
817+
connectionAddress = {
818+
address: connection.socket.remoteAddress
819+
, port: connection.socket.remotePort
820+
};
811821
}
822+
812823
return {
813824
headers: data.headers
814825
, address: connectionAddress

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "socket.io"
33
, "version": "0.7.6"
4-
, "description": "Realtime apps made cross-browser & easy with a WebSocket-like API"
4+
, "description": "Real-time apps made cross-browser & easy with a WebSocket-like API"
55
, "homepage": "http://socket.io"
66
, "keywords": ["websocket", "socket", "realtime", "socket.io", "comet", "ajax"]
77
, "author": "Guillermo Rauch <guillermo@learnboost.com>"

test/namespace.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ module.exports = {
8080
fn(null, true);
8181
})
8282
.on('connection', function (socket) {
83-
socket.handshake.address.address.should.equal('127.0.0.1');
84-
socket.handshake.address.port.should.equal(ports);
83+
(!!socket.handshake.address.address).should.be.true;
84+
(!!socket.handshake.address.port).should.be.true;
8585
socket.handshake.headers.host.should.equal('localhost');
8686
socket.handshake.headers.connection.should.equal('keep-alive');
8787
socket.handshake.time.should.match(/GMT/);

test/transports.websocket.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,8 +1493,8 @@ module.exports = {
14931493
, ws;
14941494

14951495
io.sockets.on('connection', function (socket) {
1496-
socket.handshake.address.address.should.equal('127.0.0.1');
1497-
socket.handshake.address.port.should.equal(ports);
1496+
(!!socket.handshake.address.address).should.be.true;
1497+
(!!socket.handshake.address.port).should.be.true;
14981498
socket.handshake.headers.host.should.equal('localhost');
14991499
socket.handshake.headers.connection.should.equal('keep-alive');
15001500
socket.handshake.time.should.match(/GMT/);

0 commit comments

Comments
 (0)