From 0144c50fc474c5f0145f3ac1fd2f0d2360e21695 Mon Sep 17 00:00:00 2001
From: till <till@php.net>
Date: Wed, 29 Aug 2007 06:45:17 -0400
Subject: [PATCH] # bugfix (#1484523) fixed rc_request_header function     * normalized input ($HEADER)     * also normalized the arrays     * returning "really" NULL now (without issueing a warning!)

---
 program/include/rcube_shared.inc |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index eeca2b5..a86a3c0 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -525,22 +525,29 @@
 /**
  * Read a specific HTTP request header
  *
- * @param string Header name
- * @return string Header value or null if not available
+ * @access static
+ * @param  string $name Header name
+ * @return mixed  Header value or null if not available
  */
 function rc_request_header($name)
-{
+  {
   if (function_exists('getallheaders'))
-  {
+    {
     $hdrs = getallheaders();
-    return $hdrs[$name];
-  }
+    $hdrs = array_change_key_case($hdrs, CASE_UPPER);
+    $key  = strtoupper($name);
+    }
   else
-  {
-    $key = "HTTP_" . strtoupper(strtr($name, "-", "_"));
-    return $_SERVER[$key];
+    {
+    $key  = 'HTTP_' . strtoupper(strtr($name, '-', '_'));
+    $hdrs = array_change_key_case($_SERVER[$key], CASE_UPPER);
+    }
+  if (isset($hdrs[$key]))
+    {
+    return $hdrs[$key];
+    }
+  return null;
   }
-}
 
 
 /**

--
Gitblit v1.9.1