From 7a7ad782b2f125622509a77c5a6f94ad4ae0f93c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 12 Nov 2012 17:21:01 +0200 Subject: Some micro-optimizations --- system/core/Input.php | 4 ++-- system/core/Output.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'system/core') diff --git a/system/core/Input.php b/system/core/Input.php index adc5f7ac0..4d73fa424 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -768,9 +768,9 @@ class CI_Input { foreach ($_SERVER as $key => $val) { - if (strpos($key, 'HTTP_') === 0) + if (sscanf($key, 'HTTP_%s', $header) === 1) { - $headers[substr($key, 5)] = $this->_fetch_from_array($_SERVER, $key, $xss_clean); + $headers[$header] = $this->_fetch_from_array($_SERVER, $key, $xss_clean); } } } diff --git a/system/core/Output.php b/system/core/Output.php index 9300df356..6312ccd86 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -256,9 +256,9 @@ class CI_Output { { for ($i = 0, $c = count($this->headers); $i < $c; $i++) { - if (preg_match('/^Content-Type:\s(.+)$/', $this->headers[$i][0], $matches)) + if (sscanf($this->headers[$i][0], 'Content-Type: %s', $content_type) === 1) { - return $matches[1]; + return $content_type; } } -- cgit v1.2.3-24-g4f1b