File tree 3 files changed +15
-8
lines changed
3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change
1
+
1
2
/*!
2
3
* socket.io-node
3
4
* Copyright(c) 2011 LearnBoost <dev@learnboost.com>
@@ -819,10 +820,16 @@ Manager.prototype.handshakeData = function (data) {
819
820
var connection = data . request . connection
820
821
, connectionAddress ;
821
822
822
- if ( connection . address ) {
823
- connectionAddress = connection . remoteAddress ; // Bug fix, returns client IP instead of .address() which was returning server IP
824
- } else if ( connection . socket && connection . socket . address ) {
825
- connectionAddress = connection . socket . address ( ) ; // Do we need .remoteAddress here too?
823
+ if ( connection . remoteAddress ) {
824
+ connectionAddress = {
825
+ address : connection . remoteAddress
826
+ , port : connection . remotePort
827
+ } ;
828
+ } else if ( connection . socket && connection . socket . remoteAddress ) {
829
+ connectionAddress = {
830
+ address : connection . socket . remoteAddress
831
+ , port : connection . socket . remotePort
832
+ } ;
826
833
}
827
834
828
835
return {
Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ module.exports = {
80
80
fn ( null , true ) ;
81
81
} )
82
82
. 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 ;
85
85
socket . handshake . headers . host . should . equal ( 'localhost' ) ;
86
86
socket . handshake . headers . connection . should . equal ( 'keep-alive' ) ;
87
87
socket . handshake . time . should . match ( / G M T / ) ;
Original file line number Diff line number Diff line change @@ -1493,8 +1493,8 @@ module.exports = {
1493
1493
, ws ;
1494
1494
1495
1495
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 ;
1498
1498
socket . handshake . headers . host . should . equal ( 'localhost' ) ;
1499
1499
socket . handshake . headers . connection . should . equal ( 'keep-alive' ) ;
1500
1500
socket . handshake . time . should . match ( / G M T / ) ;
You can’t perform that action at this time.
0 commit comments