summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-07-08 20:16:16 -0700
committerWolfy-J <[email protected]>2018-07-08 20:16:16 -0700
commit9f59155c781f0178e52c53abd2b437d40c51a52d (patch)
tree46672253d2872fa387fe3e1c01d71ce948c2a372
parent3ef9d686381e6f888c32c707c4ed245cb546506f (diff)
ip address fallback to attributes (for middleware)
-rw-r--r--php-src/PSR7Client.php7
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;
}