From c82b57b32c0398bd36d625b9e5f9c20f54b768d2 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Mon, 31 Dec 2012 09:22:07 -0700 Subject: Fixed normalization of headers under Apache The existing header normalization routine converts headers provided by Apache (that is, with `-` in the name instead of `_`) to all lowercase, with the exception of the first character. This is different from the expected result, wherein each word of the header is capitalized. For example, `CONTENT-LENGTH` would normalize to `Content-length` instead of the expected `Content-Length`. The reason for this is that the existing code is only converting underscores to spaces, and leaving hyphens untouched. The fix is to replace hyphens with spaces as well before passing the result through `ucwords()`. That fix is included here. Signed-off-by: Daniel Hunsaker --- system/core/Input.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core') diff --git a/system/core/Input.php b/system/core/Input.php index a3ad14e24..ebe05555d 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -788,7 +788,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