diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/PSR7Client.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/PSR7Client.php b/src/PSR7Client.php index 1136ce10..d8ec4405 100644 --- a/src/PSR7Client.php +++ b/src/PSR7Client.php @@ -146,9 +146,13 @@ class PSR7Client $server['REMOTE_ADDR'] = $ctx['attributes']['ipAddress'] ?? $ctx['remoteAddr'] ?? '127.0.0.1'; $server['REMOTE_ADDR'] = $ctx['attributes']['ipAddress'] ?? $ctx['remoteAddr'] ?? '127.0.0.1'; - $server['HTTP_USER_AGENT'] = ''; - if (isset($ctx['headers']['User-Agent'][0])) { - $server['HTTP_USER_AGENT'] = $ctx['headers']['User-Agent'][0]; + foreach ($ctx['headers'] as $key => $value) { + $key = strtoupper(str_replace('-', '_', $key)); + if (\in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) { + $_SERVER[$key] = implode(', ', $value); + } else { + $_SERVER['HTTP_' . $key] = implode(', ', $value); + } } return $server; |