diff options
| author | till <till@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2007-08-29 10:45:17 +0000 |
|---|---|---|
| committer | till <till@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2007-08-29 10:45:17 +0000 |
| commit | 5bb5fd49552a4baad0fb1e2994bfebbd88bdb119 (patch) | |
| tree | 6e7b7c84ffee69cd31bb35031f20760de1d0cf28 /roundcubemail | |
| parent | f2c3b4111d4573b7b724f7132c3e578ed418c75b (diff) | |
# bugfix (#1484523) fixed rc_request_header function
* normalized input ($HEADER)
* also normalized the arrays
* returning "really" NULL now (without issueing a warning!)
git-svn-id: https://svn.roundcube.net/trunk@736 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail')
| -rw-r--r-- | roundcubemail/program/include/rcube_shared.inc | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/roundcubemail/program/include/rcube_shared.inc b/roundcubemail/program/include/rcube_shared.inc index eeca2b57a..a86a3c048 100644 --- a/roundcubemail/program/include/rcube_shared.inc +++ b/roundcubemail/program/include/rcube_shared.inc @@ -525,22 +525,29 @@ function rc_strrpos($haystack, $needle, $offset=0) /** * 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')) { + 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; } -} /** |
