Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpFoundation] Fixed messed up headers #7189

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

Closed
wants to merge 2 commits into from

Conversation

Burgov
Copy link
Contributor

@Burgov Burgov commented Feb 26, 2013

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

I ran into this when somewhere in our code the Response object was cast into a string. After that, when send()'ing the Response, the headers would be all mixed up. This is because the __toString in HeaderBag ksorts the headers, while the __toString in ResponseHeaderBag doesn't ksort the corresponding headerNames. This patch ksorts that one as well.

allPreserveCase() is new to 2.2, so this bug doesn't seem to affect earlier versions.

To be exact, this is where it got introduced: 63a228c45613bb

Bart van den Burg added 2 commits February 26, 2013 10:14
…erBag (triggered by a __toString on Response) causes the response headers to get messed up
@Burgov
Copy link
Contributor Author

Burgov commented Feb 26, 2013

B.t.w. another option was to ksort a copy of the headers array in the ResponseBag and leaving the actual thing as-is. Not sure which one would be the best option?

fabpot added a commit that referenced this pull request Feb 26, 2013
This PR was squashed before being merged into the 2.2 branch (closes #7189).

Commits
-------

850bd5a [HttpFoundation] Fixed messed up headers

Discussion
----------

[HttpFoundation] Fixed messed up headers

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

I ran into this when somewhere in our code the Response object was cast into a string. After that, when send()'ing the Response, the headers would be all mixed up. This is because the __toString in HeaderBag ksorts the headers, while the __toString in ResponseHeaderBag doesn't ksort the corresponding headerNames. This patch ksorts that one as well.

allPreserveCase() is new to 2.2, so this bug doesn't seem to affect earlier versions.

To be exact, this is where it got introduced: 63a228c45613bb

---------------------------------------------------------------------------

by Burgov at 2013-02-26T09:27:20Z

B.t.w. another option was to ksort a copy of the headers array in the ResponseBag and leaving the actual thing as-is. Not sure which one would be the best option?
@fabpot fabpot closed this Feb 26, 2013
@Burgov Burgov deleted the fixedMessedUpHeaders branch February 26, 2013 10:09
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