@@ -25,7 +25,7 @@ class Request
25
25
const HEADER_CLIENT_PROTO = 'client_proto ' ;
26
26
const HEADER_CLIENT_PORT = 'client_port ' ;
27
27
28
- protected static $ trustProxyData = false ;
28
+ protected static $ trustProxy = false ;
29
29
30
30
protected static $ trustedProxies = array ();
31
31
@@ -382,7 +382,7 @@ public function overrideGlobals()
382
382
*/
383
383
public static function trustProxyData ()
384
384
{
385
- self ::$ trustProxyData = true ;
385
+ self ::$ trustProxy = true ;
386
386
}
387
387
388
388
/**
@@ -397,7 +397,7 @@ public static function trustProxyData()
397
397
public static function setTrustedProxies (array $ proxies )
398
398
{
399
399
self ::$ trustedProxies = $ proxies ;
400
- self ::$ trustProxyData = $ proxies ? true : false ;
400
+ self ::$ trustProxy = $ proxies ? true : false ;
401
401
}
402
402
403
403
/**
@@ -522,7 +522,7 @@ public function getClientIp($proxy = false)
522
522
{
523
523
$ ip = $ this ->server ->get ('REMOTE_ADDR ' );
524
524
525
- if (!$ proxy && !self ::$ trustProxyData ) {
525
+ if (!$ proxy && !self ::$ trustProxy ) {
526
526
return $ ip ;
527
527
}
528
528
@@ -533,7 +533,7 @@ public function getClientIp($proxy = false)
533
533
$ clientIps = array_map ('trim ' , explode (', ' , $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_IP ])));
534
534
$ clientIps [] = $ ip ;
535
535
536
- $ trustedProxies = ($ proxy || self ::$ trustProxyData ) && !self ::$ trustedProxies ? array ($ ip ) : self ::$ trustedProxies ;
536
+ $ trustedProxies = ($ proxy || self ::$ trustProxy ) && !self ::$ trustedProxies ? array ($ ip ) : self ::$ trustedProxies ;
537
537
$ clientIps = array_diff ($ clientIps , $ trustedProxies );
538
538
539
539
return array_pop ($ clientIps );
@@ -647,7 +647,7 @@ public function getScheme()
647
647
*/
648
648
public function getPort ()
649
649
{
650
- if (self ::$ trustProxyData && self ::$ trustedHeaders [self ::HEADER_CLIENT_PORT ] && $ port = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_PORT ])) {
650
+ if (self ::$ trustProxy && self ::$ trustedHeaders [self ::HEADER_CLIENT_PORT ] && $ port = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_PORT ])) {
651
651
return $ port ;
652
652
}
653
653
@@ -776,7 +776,7 @@ public function getQueryString()
776
776
*/
777
777
public function isSecure ()
778
778
{
779
- if (self ::$ trustProxyData && self ::$ trustedHeaders [self ::HEADER_CLIENT_PROTO ] && $ proto = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_PROTO ])) {
779
+ if (self ::$ trustProxy && self ::$ trustedHeaders [self ::HEADER_CLIENT_PROTO ] && $ proto = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_PROTO ])) {
780
780
return in_array (strtolower ($ proto ), array ('https ' , 'on ' , '1 ' ));
781
781
}
782
782
@@ -800,7 +800,7 @@ public function isSecure()
800
800
*/
801
801
public function getHost ()
802
802
{
803
- if (self ::$ trustProxyData && self ::$ trustedHeaders [self ::HEADER_CLIENT_HOST ] && $ host = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_HOST ])) {
803
+ if (self ::$ trustProxy && self ::$ trustedHeaders [self ::HEADER_CLIENT_HOST ] && $ host = $ this ->headers ->get (self ::$ trustedHeaders [self ::HEADER_CLIENT_HOST ])) {
804
804
$ elements = explode (', ' , $ host );
805
805
806
806
$ host = trim ($ elements [count ($ elements ) - 1 ]);
0 commit comments