diff options
author | Andrey Andreev <narf@devilix.net> | 2016-04-04 09:28:31 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-04-04 09:28:31 +0200 |
commit | cd3d5956f7880091740489c5f24af0e72f677c0c (patch) | |
tree | a69e9505053cb3af8fe5971c18876a06784ecf76 /system/core/Input.php | |
parent | 85dfc2a6f76ca95e803535c25877e2aa1c05c38b (diff) |
Fix #4563
Diffstat (limited to 'system/core/Input.php')
-rw-r--r-- | system/core/Input.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/system/core/Input.php b/system/core/Input.php index a7c9ecd0d..50ca047e8 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -760,30 +760,32 @@ class CI_Input { // If header is already defined, return it immediately if ( ! empty($this->headers)) { - return $this->headers; + return $this->_fetch_from_array($this->headers, NULL, $xss_clean); } // In Apache, you can simply call apache_request_headers() if (function_exists('apache_request_headers')) { - return $this->headers = apache_request_headers(); + $this->headers = apache_request_headers(); } - - $this->headers['Content-Type'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : @getenv('CONTENT_TYPE'); - - foreach ($_SERVER as $key => $val) + else { - if (sscanf($key, 'HTTP_%s', $header) === 1) + isset($_SERVER['CONTENT_TYPE']) && $this->headers['Content-Type'] = $_SERVER['CONTENT_TYPE']; + + foreach ($_SERVER as $key => $val) { - // take SOME_HEADER and turn it into Some-Header - $header = str_replace('_', ' ', strtolower($header)); - $header = str_replace(' ', '-', ucwords($header)); + if (sscanf($key, 'HTTP_%s', $header) === 1) + { + // take SOME_HEADER and turn it into Some-Header + $header = str_replace('_', ' ', strtolower($header)); + $header = str_replace(' ', '-', ucwords($header)); - $this->headers[$header] = $this->_fetch_from_array($_SERVER, $key, $xss_clean); + $this->headers[$header] = $_SERVER[$key]; + } } } - return $this->headers; + return $this->_fetch_from_array($this->headers, NULL, $xss_clean); } // -------------------------------------------------------------------- |