diff options
author | Daniel Hunsaker <danhunsaker@gmail.com> | 2012-12-31 17:22:07 +0100 |
---|---|---|
committer | Daniel Hunsaker <danhunsaker@gmail.com> | 2012-12-31 17:22:07 +0100 |
commit | c82b57b32c0398bd36d625b9e5f9c20f54b768d2 (patch) | |
tree | 996e31ec71c0c3f9be4c9c4b06019621a8d27ebc | |
parent | 88257ce618483e4477cbfed0e2f0b4c429533e09 (diff) |
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 <danhunsaker@gmail.com>
-rw-r--r-- | system/core/Input.php | 2 |
1 files changed, 1 insertions, 1 deletions
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; |