Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed normalization of headers under Apache #2107

Merged
merged 1 commit into from
Dec 31, 2012
Merged

Fixed normalization of headers under Apache #2107

merged 1 commit into from
Dec 31, 2012

Conversation

danhunsaker
Copy link
Contributor

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

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>
narfbg added a commit that referenced this pull request Dec 31, 2012
Fixed normalization of headers under Apache
@narfbg narfbg merged commit f7c74a6 into bcit-ci:develop Dec 31, 2012
chernjie added a commit to chernjie/CodeIgniter that referenced this pull request Apr 16, 2013
headers and should be pass through as is.
This is a follow up on bcit-ci#2107 (c82b57b) by @danhunsaker;
chernjie added a commit to chernjie/CodeIgniter that referenced this pull request Apr 16, 2013
headers and should be pass through as is.
This is a follow up on bcit-ci#2107 (c82b57b) by @danhunsaker;
nonchip pushed a commit to nonchip/CodeIgniter that referenced this pull request Jun 29, 2013
…lization

Fixed normalization of headers under Apache
nonchip pushed a commit to nonchip/CodeIgniter that referenced this pull request Jun 29, 2013
headers and should be pass through as is.
This is a follow up on bcit-ci#2107 (c82b57b) by @danhunsaker;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants