@@ -35,7 +35,7 @@ class Request
35
35
const HEADER_CLIENT_PROTO = 'client_proto ' ;
36
36
const HEADER_CLIENT_PORT = 'client_port ' ;
37
37
38
- protected static $ trustProxyData = false ;
38
+ protected static $ trustProxy = false ;
39
39
40
40
protected static $ trustedProxies = array ();
41
41
@@ -466,7 +466,7 @@ public function overrideGlobals()
466
466
*/
467
467
public static function trustProxyData ()
468
468
{
469
- self ::$ trustProxyData = true ;
469
+ self ::$ trustProxy = true ;
470
470
}
471
471
472
472
/**
@@ -481,7 +481,7 @@ public static function trustProxyData()
481
481
public static function setTrustedProxies (array $ proxies )
482
482
{
483
483
self ::$ trustedProxies = $ proxies ;
484
- self ::$ trustProxyData = $ proxies ? true : false ;
484
+ self ::$ trustProxy = $ proxies ? true : false ;
485
485
}
486
486
487
487
/**
@@ -676,7 +676,7 @@ public function getClientIp()
676
676
{
677
677
$ ip = $ this ->server ->get ('REMOTE_ADDR ' );
678
678
679
- if (!self ::$ trustProxyData ) {
679
+ if (!self ::$ trustProxy ) {
680
680
return $ ip ;
681
681
}
682
682
@@ -687,7 +687,7 @@ public function getClientIp()
687
687
$ clientIps = array_map ('trim ' , explode (', ' , $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_IP ])));
688
688
$ clientIps [] = $ ip ;
689
689
690
- $ trustedProxies = self ::$ trustProxyData && !self ::$ trustedProxies ? array ($ ip ) : self ::$ trustedProxies ;
690
+ $ trustedProxies = self ::$ trustProxy && !self ::$ trustedProxies ? array ($ ip ) : self ::$ trustedProxies ;
691
691
$ clientIps = array_diff ($ clientIps , $ trustedProxies );
692
692
693
693
return array_pop ($ clientIps );
@@ -803,7 +803,7 @@ public function getScheme()
803
803
*/
804
804
public function getPort ()
805
805
{
806
- if (self ::$ trustProxyData && self ::$ trustedHeaders [self ::HEADER_CLIENT_PORT ] && $ port = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_PORT ])) {
806
+ if (self ::$ trustProxy && self ::$ trustedHeaders [self ::HEADER_CLIENT_PORT ] && $ port = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_PORT ])) {
807
807
return $ port ;
808
808
}
809
809
@@ -965,7 +965,7 @@ public function getQueryString()
965
965
*/
966
966
public function isSecure ()
967
967
{
968
- if (self ::$ trustProxyData && self ::$ trustedHeaders [self ::HEADER_CLIENT_PROTO ] && $ proto = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_PROTO ])) {
968
+ if (self ::$ trustProxy && self ::$ trustedHeaders [self ::HEADER_CLIENT_PROTO ] && $ proto = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_PROTO ])) {
969
969
return in_array (strtolower ($ proto ), array ('https ' , 'on ' , '1 ' ));
970
970
}
971
971
@@ -989,7 +989,7 @@ public function isSecure()
989
989
*/
990
990
public function getHost ()
991
991
{
992
- if (self ::$ trustProxyData && self ::$ trustedHeaders [self ::HEADER_CLIENT_HOST ] && $ host = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_HOST ])) {
992
+ if (self ::$ trustProxy && self ::$ trustedHeaders [self ::HEADER_CLIENT_HOST ] && $ host = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_HOST ])) {
993
993
$ elements = explode (', ' , $ host );
994
994
995
995
$ host = trim ($ elements [count ($ elements ) - 1 ]);
0 commit comments