From 71cff1da396ba0c56644c04fdd2729db6766c557 Mon Sep 17 00:00:00 2001 From: CJ Date: Tue, 16 Apr 2013 21:50:55 +0800 Subject: #2409: Updated based on feedback by @narfbg; --- system/core/Input.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'system/core/Input.php') diff --git a/system/core/Input.php b/system/core/Input.php index 31bd7008b..7a6b6e4e0 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -790,10 +790,16 @@ class CI_Input { */ public function request_headers($xss_clean = FALSE) { + // If header is already defined, return it immediately + if ( ! empty($this->headers)) + { + return $this->headers; + } + // In Apache, you can simply call apache_request_headers() if (function_exists('apache_request_headers')) { - $this->headers = apache_request_headers(); + return $this->headers = apache_request_headers(); } else { @@ -810,7 +816,7 @@ class CI_Input { // take SOME_HEADER and turn it into Some-Header foreach ($headers as $key => $val) { - $key = str_replace('_', ' ', strtolower($key)); + $key = str_replace(array('_', '-'), ' ', strtolower($key)); $key = str_replace(' ', '-', ucwords($key)); $this->headers[$key] = $val; -- cgit v1.2.3-24-g4f1b