Commit 190417f9 by Carsten Brandt

small refactoring + cleanup request

parent 6f829596
...@@ -180,14 +180,13 @@ class Request extends \yii\base\Request ...@@ -180,14 +180,13 @@ class Request extends \yii\base\Request
{ {
if ($this->_headers === null) { if ($this->_headers === null) {
$this->_headers = new HeaderCollection; $this->_headers = new HeaderCollection;
$headers = [];
if (function_exists('getallheaders')) { if (function_exists('getallheaders')) {
$headers = getallheaders(); $headers = getallheaders();
} elseif (function_exists('http_get_request_headers')) { } elseif (function_exists('http_get_request_headers')) {
$headers = http_get_request_headers(); $headers = http_get_request_headers();
} else { } else {
foreach ($_SERVER as $name => $value) { foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') { if (strncmp($name, 'HTTP_', 5) === 0) {
$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))); $name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
$this->_headers->add($name, $value); $this->_headers->add($name, $value);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment