diff options
author | Wolfy-J <[email protected]> | 2018-07-08 20:16:16 -0700 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-07-08 20:16:16 -0700 |
commit | 9f59155c781f0178e52c53abd2b437d40c51a52d (patch) | |
tree | 46672253d2872fa387fe3e1c01d71ce948c2a372 | |
parent | 3ef9d686381e6f888c32c707c4ed245cb546506f (diff) |
ip address fallback to attributes (for middleware)
-rw-r--r-- | php-src/PSR7Client.php | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/php-src/PSR7Client.php b/php-src/PSR7Client.php index dc0070a9..e8d93fe8 100644 --- a/php-src/PSR7Client.php +++ b/php-src/PSR7Client.php @@ -107,7 +107,7 @@ class PSR7Client ])); } - /** + /** * Returns altered copy of _SERVER variable. Sets ip-address, * request-time and other values. * @@ -119,10 +119,7 @@ class PSR7Client $server = $_SERVER; $server['REQUEST_TIME'] = time(); $server['REQUEST_TIME_FLOAT'] = microtime(true); - - if (!empty($ctx['remoteAddr'])) { - $server['REMOTE_ADDR'] = $ctx['remoteAddr']; - } + $server['REMOTE_ADDR'] = $ctx['attributes']['ipAddress'] ?? $ctx['remoteAddr'] ?? '127.0.0.1'; return $server; } |