summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Output.php35
1 files changed, 34 insertions, 1 deletions
diff --git a/system/core/Output.php b/system/core/Output.php
index 6312ccd86..7bfde07c7 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -256,7 +256,7 @@ class CI_Output {
{
for ($i = 0, $c = count($this->headers); $i < $c; $i++)
{
- if (sscanf($this->headers[$i][0], 'Content-Type: %s', $content_type) === 1)
+ if (sscanf($this->headers[$i][0], 'Content-Type: %[^;]', $content_type) === 1)
{
return $content_type;
}
@@ -268,6 +268,39 @@ class CI_Output {
// --------------------------------------------------------------------
/**
+ * Get Header
+ *
+ * @param string $header_name
+ * @return string
+ */
+ public function get_header($header)
+ {
+ // Combine headers already sent with our batched headers
+ $headers = array_merge(
+ // We only need [x][0] from our multi-dimensional array
+ array_map('array_shift', $this->headers),
+ headers_list()
+ );
+
+ if (empty($headers) OR empty($header))
+ {
+ return NULL;
+ }
+
+ for ($i = 0, $c = count($headers); $i < $c; $i++)
+ {
+ if (strncasecmp($header, $headers[$i], $l = strlen($header)) === 0)
+ {
+ return trim(substr($headers[$i], $l+1));
+ }
+ }
+
+ return NULL;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Set HTTP Status Header
*
* As of version 1.7.2, this is an alias for common function